
var BLOG_VERIFY_CODE = 8000103; 
var tmpl = (function() {
    var cache = {}; 
    return function tmpl(str, data) {
        var fn = !/\W/.test(str) ? 
			cache[str] = cache[str] || tmpl(document.getElementById(str).innerHTML) : 
			new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);}; with(obj){p.push('" + str.replace(/[\r\t\n]/g, " ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g, "$1\r").replace(/\t=(.*?)%>/g, "',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'")+ "');}return p.join('');"); 
		return data ? fn(data) : fn;
    };
})(); 

function dateFormat(date, fmt) {
    if (!fmt) fmt = "yyyy-MM-dd hh:mm:ss"; var o = { "M+": date.getMonth() + 1, "d+": date.getDate(), "h+": date.getHours(), "m+": date.getMinutes(), "s+": date.getSeconds(), "q+": Math.floor((date.getMonth() + 3) / 3), "S": date.getMilliseconds() }; if (/(y+)/.test(fmt)) { fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); }
    for (var k in o) { 
		if (new RegExp("(" + k + ")").test(fmt)) { 
			fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); 
		}
	}
    return fmt;
}
function isUndefined(obj) { 
	return typeof (obj) == "undefined"; 
}
function presentDate(time) { 
	var date = new Date(time * 1000); 
	return appDateFormat(date, new Date()); 
}
function removeHTMLTag(str) {
    if (!str) { return ''; }
    var reg_htmltag = /<.*?>/g; return str.replace(reg_htmltag, '');
}
function removeHighlightHTMLTag(str) {
    if (!str) { return ''; }
    var reg_htmltag = /<span class=\"c_tx4\">(.*?)<\/span>/g; return str.replace(reg_htmltag, '$1');
}
function escHighlightHTML(content) { content = content.replace(/<span class=\"c_tx4\">(.*?)<\/span>/g, '{highlight_tag_start}$1{highlight_tag_end}'); content = QZFL.string.escHTML(content); content = content.replace(/{highlight_tag_start}(.*?){highlight_tag_end}/g, '<span class="c_tx4">$1</span>'); return content; }
function isDeepStyle() {
    if (QZONE.FP) { return QZONE.FP.checkIsDeepColor(); }
    return false;
}
function removeUBB(s) { 
	if (QZONE.FP) { 
		return QZONE.FP.removeUBB(s); 
	} else { 
		return s; 
	} 
}
function replaceIconTag(textContent) { 
	if (QZONE.FP) { 
		return QZONE.FP.replaceIconTag(textContent); 
	} else { 
		return textContent; 
	} 
}
function replaceAtData(content) { 
	var reg = /\@{uin:([^,]*),nick:([^\}]*)\}/g; 
	return content.replace(reg, function(atWords, uin, nick) { 
									return format('<a href="http://user.qzone.qq.com/{0}" class="q_namecard q_des c_tx" link="nameCard_{0} des_{0}" target="_blank"> @{1}</a>', uin, decodeURIComponent(nick)); 
								}); 
}
function replaceUrl(content) { 
	var reg = /(https?:\/\/)(([-A-Za-z0-9]+(\.[-A-Za-z0-9]+)*(\.[-A-Za-z]{2,5}))|([0-9]{1,3}(\.[0-9]{1,3}){3}))(:[0-9]*)?(\/[-A-Za-z0-9_\$\.\+\!\*\(\),;:@&=\?\/~\#\%]*)*/g; 
	return content.replace(reg, '<a href="$&" class="c_tx" target="_blank">$&</a>'); 
}
function appDateFormat(date, nowDate) {
    if (date.getTime() == 0) { return '刚刚'; }
    var now = new Date(nowDate.getFullYear(), nowDate.getMonth(), nowDate.getDate()); now.setHours(nowDate.getHours()); now.setMinutes(nowDate.getMinutes()); now.setSeconds(nowDate.getSeconds()); 
	var timelag = now.getTime() - date.getTime(); if (timelag <= 0) { return '刚刚'; }
    if (timelag < 1800000) { 
		return (Math.ceil(timelag / (60 * 1000)) + '分钟前'); 
	}
    now.setDate(now.getDate() - 1);
    now.setHours(23); 
	now.setMinutes(59); 
	now.setSeconds(59); 
	if (date.getTime() > now.getTime()) { return ('今天' + dateFormat(date, 'hh:mm')); }
    now.setDate(now.getDate() - 1);
    if (date.getTime() > now.getTime()) { return ('昨天' + dateFormat(date, 'hh:mm')); }
    now.setFullYear(now.getFullYear() - 1); 
	now.setMonth(11); now.setDate(31); 
	if (date.getTime() > now.getTime()) { return dateFormat(date, 'MM-dd hh:mm'); }
    return dateFormat(date, 'yyyy-MM-dd hh:mm');
}
function MoodComment(conf) { 
	var comment = new Comment(conf); 
	comment.ptid = conf.ptid; 
	comment.puin = conf.puin; return comment; 
}
function MoodReply(conf) { 
	var reply = new Reply(conf); 
	reply.ptid = conf.ptid; 
	reply.puin = conf.puin; 
	reply.ctid = conf.ctid; 
	reply.cuin = conf.cuin; 
	return reply; 
}
var XMLselectSingleNode = (function() {
    function BlogXMLselectSingleNode(data, xpath) {
        var x = BlogXMLselectNodes(data, xpath); if (!x || x.length < 1) { return null; }
        return x[0];
    }
    function BlogXMLselectNodes(data, xpath) {
        var xpe = new XPathEvaluator(); var nsResolver = xpe.createNSResolver(data.ownerDocument == null ? data.documentElement : data.ownerDocument.documentElement); var result = xpe.evaluate(xpath, data, nsResolver, 0, null); var found = []; var res; while (res = result.iterateNext()) { found.push(res); }
        return found;
    }
    function XMLSelectNodes(data, path) {
        if (QZFL.userAgent.ie) { return data.selectNodes(path); }
        else { return BlogXMLselectNodes(data, path); } 
    }
    function XMLselectSingleNode(data, path) {
        if (QZFL.userAgent.ie) { return data.selectSingleNode(path); }
        else { return BlogXMLselectSingleNode(data, path); } 
    }
    function isXMLDoc(data) {
        try { XMLselectSingleNode(data, "/"); return true; }
        catch (err) { return false; } 
    }
    return XMLselectSingleNode;
})(); 
function getXMLNodeText(node) {
    if (!node) { return null; }
    if (typeof (node.innerText) != "undefined") { return node.innerText; }
    else if (typeof (node.textContent) != "undefined") { return node.textContent; }
    return node.text;
}
var ImageViewer = { h: { w: 0, h: 0, css: ";" }, v: { w: 0, h: 0, css: ";"} }; 

function loadImage(c, b, g, f, w, h) {
    c.style.width = c.width = w; 
	c.style.height = c.height = h; 
	var d = c.getContext("2d"); d.save(); 
	if (f <= Math.PI / 2) { 
		d.translate(g * c.oImage.height, 0); 
	} else { 
		if (f <= Math.PI) { 
			d.translate(c.width, -b * c.oImage.height); 
		} else { 
			if (f <= 1.5 * Math.PI) { 
				d.translate(-b * c.oImage.width, c.height); 
			} else { 
				d.translate(0, -g * c.oImage.width); 
			} 
		} 
	}
    try { 
		d.rotate(f); d.drawImage(c.oImage, 0, 0, c.oImage.width, c.oImage.height); d.restore(); 
	} catch (i) { 
		console && console.log(i.message); 
	} 
}
function resizeOrgImage(img) {
    var maxWidth = 430; 
	var finger = img.getAttribute("param"); 
	ImageViewer[finger] = { h: { w: 0, h: 0, css: ";" }, v: { w: 0, h: 0, css: ";"} }; 
	ImageViewer[finger].h.w = ImageViewer[finger].v.w = img.width; 
	ImageViewer[finger].h.h = ImageViewer[finger].v.h = img.height; 
	if (img.height > maxWidth) { 
		ImageViewer[finger].v.w = parseInt(maxWidth * img.width / img.height); 
		ImageViewer[finger].v.h = maxWidth; 
		ImageViewer[finger].v.css = ";width:auto;height:" + maxWidth + "px;"; 
	}
    if (img.width > maxWidth) { 
		ImageViewer[finger].h.w = maxWidth; 
		ImageViewer[finger].h.h = parseInt(maxWidth * img.height / img.width); ImageViewer[finger].h.css = ";width:" + maxWidth + "px;height:auto;"; 
		img.style.cssText += ImageViewer[finger].h.css; 
	} 
}
function rotateImage(i, j, d, finger) {
    var info = ImageViewer[finger]; 
	if (!info) { return; }
    if (d) { 
		i.angle = ((i.angle == undefined ? 0 : i.angle) + j) % 360; 
	} else { 
		i.angle = j; 
	}
    if (i.angle >= 0) { 
		var f = Math.PI * i.angle / 180; 
	} else { 
		var f = Math.PI * (360 + i.angle) / 180; 
	}
    var m = i.angle % 180 ? "v" : "h"; 
	var b = Math.cos(f); 
	var g = Math.sin(f); 
	if (document.uniqueID !== document.uniqueID) { 
		var c = new Image(); 
		c.style.cssText += info[m].css; 
		c.src = i.src; 
		c.style.filter = "progid:DXImageTransform.Microsoft.Matrix(M11=" + b + ",M12=" + -g + ",M21=" + g + ",M22=" + b + ",SizingMethod='auto expand')"; 
	} else {
        var c = document.createElement("canvas"); 
		if (!i.oImage) { 
			c.oImage = new Image();
			c.oImage.src = i.src; 
			c.oImage.width = info[m].w; 
			c.oImage.height = info[m].h; 
			c.oImage.onload = function() { 
								loadImage(c, b, g, f, m === "h" ? info.h.w : info.v.h, m === "h" ? info.h.h : info.v.w); 
							  }; 
		}
        else { 
			c.oImage = i.oImage; 
			c.oImage.width = info[m].w; 
			c.oImage.height = info[m].h; 
			loadImage(c, b, g, f, m === "h" ? info.h.w : info.v.h, m === "h" ? info.h.h : info.v.w); 
		} 
    }
    c.id = i.id; 
	c.title = i.title; 
	c.angle = i.angle; 
	c.angle = c.angle < 0 ? 360 + c.angle : c.angle; 
	i.parentNode.replaceChild(c, i);
}
function getHomeLink(uin, tar, opt) { 
	var isCampus = isNaN(uin), 
		opt = opt || {}, 
		target; 
	target = isCampus ? "http://xiaoyou.qq.com/index.php?mod=profile&u=" + uin : "http://user.qzone.qq.com/" + uin; 
	window.open(target); 
}
function shuffleArray(ar) {
    var rnd, tmp; 
	if (typeof ar != 'undefined') {
        for (var i = 0; i < ar.length; i++) { 
			rnd = Math.floor(Math.random() * ar.length); tmp = ar[i]; ar[i] = ar[rnd]; ar[rnd] = tmp; 
		}
        return ar;
    } else { 
		return []; 
	} 
}
function inArray(e, a) {
    if ('object' != typeof a || 0 == a.length) { return false; }
    for (var i = 0; i < a.length && a[i] != e; i++); 
		return !(i == a.length);
}
var g_Parent, g_Uin, g_Nickname, g_LoginInfo, g_isAlpha, g_BaseUrl; 

var qs = QzoneSoso = { 
		searchid: '', 
		data_hotwords: null, 
		useNewSoren: false, 
		BINGO_ALL: 4294967295, 
		errMap: { "-300": "请先登录", "-301": "出错啦，请稍后再试", "-104": "出错啦，请重试" },
		entryMap: { 'FROM_QZONE_BLOG': '64' }, 
		URL: {	search: 'http://search.qzone.qq.com/cgi-bin/qzonesoso/cgi_qzonesoso_search', 
				snapshot: 'http://search.qzone.qq.com/cgi-bin/qzonesoso/cgi_qzonesoso_snapshot', 
				errlog: 'http://search.qzone.qq.com/cgi-bin/qzonesoso/cgi_qzonesoso_erroranaly', 
				sosopv: 'http://search.qzone.qq.com/cgi-bin/qzonesoso/cgi_qzonesoso_clickstream', 
				morefriend: 'http://search.qzone.qq.com/cgi-bin/qzonesoso/cgi_qzonesoso_more', 
				hotsearch: 'http://' + QZONE.FP._t.g_R_Domain + '/cgi-bin/qzonesoso/cgi_qzonesoso_hotword', 
				searchtrend: 'http://' + QZONE.FP._t.imgcacheDomain + '/qzone/v6/v6_config/qzonesoso_searchtrend.js', 
				interestedpeople: 'http://r.qzone.qq.com/cgi-bin/potential/potentialpeople.cgi', 
				sorensearch: 'http://search.qzone.qq.com/cgi-bin/qzonesoso/cgi_qzonesoso_soren' }, 
				initBase: function() { 
							qs.initGlobal(); 
							qs.initParameters(); 
							qs._initTab(); 
							qs._initTopSearchInputToggleStyle(); 
							qs._initBottomSearchInputToggleStyle(); 
							qs.setLogo(); 
							qs.SearchHistory.init("widget_history"); 
							qs.HotSearch.init("widget_hotsearch"); 
							qs.SearchTrend.init("widget_searchtrend"); 
							qs.Filter.init('filterContainer');
							qs.setReturnURL(); 
						  }, 
				initGlobal: function() { 
								g_Parent = QZONE.FP._t; 
								g_Uin = g_Parent.g_iLoginUin; 
								QZONE.FP.getPortraitList([g_Uin], function(o) { 
																	g_LoginInfo = o[g_Uin]; 
																  },
																  { customTime: 100 }
														 ); 
								g_Nickname = QZONE.FP.getNickname(); 
								g_isAlpha = !!QZONE.FP.getBitMapFlag(58); 
								g_BaseUrl = (!!g_Uin) ? 'http://user.qzone.qq.com/' + g_Uin : 'http://rc.qzone.qq.com/'; 
							}, 
				initParameters: function() {
									var businesstypeMap = { "all": 7, "blog": 1, "mood": 2, "friend": -1 }; 
									var p = QZFL.extend({}, ENV.get("queryString"), ENV.get("queryHash")), t = qs.Parameters; 
									for (var k in p) { 
										t[k] = decodeURIComponent(p[k]); 
									}
									if (t.businesstype) { 
										businesstypeMap[t.businesstype] && (t.businesstype = businesstypeMap[t.businesstype]); 
									}
									if (qs.entryMap.FROM_QZONE_BLOG == t.entry || parseInt(qs.entryMap.FROM_QZONE_BLOG) == t.entry) { 
										if (g_Parent.ownermode) { 
											t.resultset = 3; 
											qs.PV('myblog-txt'); 
										} else { 
											t.resultset = 4; qs.PV('otherblog-txt'); 
										} 
									} 
								}, 
				doSearch: QZFL.emptyFn, 
				initNamecard: function(el) {
								if (el) { 
									var jsBaseURL = 'http://' + g_Parent.siDomain; var namecardJS = [jsBaseURL + '/qzone/v5/namecardv2.js']; 
									setTimeout(function() { 
										QZFL.imports(namecardJS, function() { QZONE.namecard.init(el); }); 
									}, 100); 
								}
								return;
							  }, 
				_initTopSearchInputToggleStyle: function() { 
													$e('#search_keyword').onFocus(function() { $e(this).getParent().removeClass('bor2').addClass('textinput_focus'); })
																		 .onBlur(function() { $e(this).getParent().addClass('bor2').removeClass('textinput_focus'); }); 
												}, 
				_initBottomSearchInputToggleStyle: function() { 
														$e('#search_bottom_keyword').onFocus(function() { $e(this).getParent().removeClass('bor2').addClass('textinput_focus'); })
																					.onBlur(function() { $e(this).getParent().addClass('bor2').removeClass('textinput_focus'); }); 
												   }, 
				_hoverBlurSmart: function() {
									var SmartBoxes = [{ item: "inputSearchBox", top: true }, { item: "search_keyword", top: false}]; 
									for (var idx = 0; idx < SmartBoxes.length; idx++) {
										var tmp = null; 
										if (SmartBoxes[idx]['top'])
											(tmp = top.$(SmartBoxes[idx]['item'])) ? tmp.blur() : null; 
										else
											(tmp = $(SmartBoxes[idx]['item'])) ? tmp.blur() : null;
								 } 
			}, 
		_initTab: function() {
					$e('div.fn_search_nav li.more').onHover(function() { 
															qs._hoverBlurSmart(); 
															$e(this).find('.more_link').addClass('bor2 bg'); 
															$e(this).addClass('more_hover'); 
															$e(this).find('ul').removeClass('none'); 
														}, 
														function() { 
															$e(this).find('.more_link').removeClass('bor2 bg'); 
															$e(this).removeClass('more_hover'); 
															$e(this).find('ul').addClass('none'); 
														}
													); 
					$e('div.fn_search_nav li.more li').onHover(function() { 
																$e(this).addClass('bg6'); 
															}, 
															function() { 
																$e(this).removeClass('bg6'); 
															}
														); 
					var keyWord, prefixURL = 'http://rc.qzone.qq.com/'; 
					if (!$('search_keyword')) { 
						keyWord = qs.Parameters.search; 
					}
					$e('#app_tab_link').onClick(function(a) { 
						if (keyWord = $('search_keyword').value) { 
							qs.PV('result-app'); 
							window.open(prefixURL + 'appstoresoso?search=' + encodeURIComponent(keyWord) + '&domain=1&type=0'); 
						} 
					}); 
					$e('#movie_tab_link').onClick(function() { 
						if (keyWord = $('search_keyword').value) { 
							qs.PV('result-video'); 
							window.open(prefixURL + 'appsetup/video/search/' + encodeURI(keyWord) + '?source=hottopic'); 
						} 
					}); 
					$e('#famous_tab_link').onClick(function() { 
						if (keyWord = $('search_keyword').value) { 
							qs.PV('result-auth'); window.open(prefixURL + 'spacesoso?keyword=' + encodeURIComponent(keyWord)); 
						} 
					}); 
					$e('#food_tab_link').onClick(function() { 
						if (keyWord = $('search_keyword').value) { 
							qs.PV('result-meishi'); 
							window.open(prefixURL + 'myhome/qqmeishi?search=1&&a=0&k=' + encodeURIComponent(keyWord) + '&o=k_a&rp=txt.QzoneSearch.a'); 
						} 
					}); 
					$e('#others_tab_link').onClick(function() { 
						if (keyWord = $('search_keyword').value) { 
							qs.PV('result-others'); 
							window.open('http://www.soso.com/more.shtml?w=' + encodeURIComponent(keyWord)); 
						} 
					});
				}, 
		getBaseSearchData: function(keyword, callback, errCallback, opt) {
								window.stat_search = new Date(); 
								var searchstat = g_Parent.TCISD.createTimeStat("qzonesosoSearch", [175, 201, 1]); 
								searchstat.setZero(); 
								var opt = opt || {}; 
								var data = { uin: g_Uin, 
											 search: QZFL.string.cut(keyword, 200, ""), 
											 sort: isUndefined(opt.sort) ? 0 : 
											 opt.sort, 
											 start: isUndefined(opt.start) ? 0 : opt.start, 
											 end: isUndefined(opt.end) ? 0 : opt.end, 
											 entry: isUndefined(opt.entry) ? 0 : opt.entry, 
											 businesstype: isUndefined(opt.businesstype) ? 0 : opt.businesstype, 
											 mix: isUndefined(opt.mix) ? 1 : opt.mix, 
											 resultset: isUndefined(opt.resultset) ? 0 : opt.resultset, 
											 similarnum: 5, 
											 maxfriendnum: isUndefined(opt.maxfriendnum) ? 0 : opt.maxfriendnum, daynum: isUndefined(opt.daynum) ? 0 : opt.daynum, 
											 bingo: isUndefined(opt.bingo) ? 0 : opt.bingo, 
											 searchid: !opt.searchid ? qs.getSearchId() : opt.searchid 
										   }; 
								qs.searchid = data.searchid; 
								var resultset = data.resultset; 
								if ('string' == typeof resultset) { 
									resultset = parseInt(resultset); 
								}
								if (3 == resultset || 4 == resultset) { 
									data.guestuin = g_Parent.g_iUin; 
								}
								if ("" == QZFL.string.trim(keyword)) {
									if (typeof (errCallback) == "function") { setTimeout(function() { errCallback({ ret: -102, msg: "no data" }); }, 0); }
									return;
								}
								if (128 < QZFL.string.getRealLen(qs.Parameters.search)) {
									if (typeof (errCallback) == "function") { setTimeout(function() { errCallback({ ret: -102, msg: "no data" }); }, 0); }
									return;
								}
								qs.SearchHistory.insert(qs.Parameters.search); 
								var jg = new QZFL.JSONGetter(qs.URL.search, "search", data, "utf-8"); 
								var ts = new Date(); 
								jg.onSuccess = function(o) {
									var te = new Date(); 
									if (qs.cgiReturnStatic(o.ret)) { 
										g_Parent.TCISD.valueStat(400086, 1, 13, { duration: (te - ts) }); 
									} else { 
										g_Parent.TCISD.valueStat(400086, 3, 15, { duration: (te - ts) }); 
									}
									if (window.isfirst) { } 
									else { searchstat.mark(15); }
									if (qs.resolveError(o.ret, o.msg) && o.data.resultdata.length > 0) { 
										if (typeof (callback) == "function") { 
											setTimeout(function() { callback(o); }, 0); 
										} 
									} else if (o.ret == -300) {
										QZONE.FP.hideMsgbox(); 
										QZONE.FP.showLoginBox("qzonesoso", function() { qs.doSearch(); });
										return false;
									} else {
										if (!qs.cgiReturnStatic(o.ret)) { 
											var errData = { searchType: 0, searchID: o.searchid, errorCode: o.ret, msg: o.msg, errorCodeSoso: o.errorcode_soso, msgSoso: o.msg_soso }; 
											qs.errorLog(errData); 
										}
										if (typeof (errCallback) == "function") { 
											setTimeout(function() { errCallback(o); }, 0); 
										} 
									} 
								}; 
								jg.onError = function(e) { 
									var te = new Date(); 
									g_Parent.TCISD.valueStat(400086, 2, 14, { duration: (te - ts) }); 
									QZONE.FP.showMsgbox("网络繁忙，请稍后再试", 5, 2000); 
									var errData; 
									errData = { searchType: 0, searchID: data.searchid, errorCode: -900, msg: 'JSON error or HTTP/CGI error' }; 
									qs.errorLog(errData); 
								}; 
								jg.send("callback");
							}, 
		resolveError: function(code, msg) {
			var map = qs.errMap; 
			if (code == 0) { return true; } 
			else {
				if (map[code]) { QZONE.FP.showMsgbox(map[code], 5, 2000); }
			return false;
		} 
	}, 
	cgiReturnStatic: function(cgiReturnCode) {
		var res = true; 
		cgiReturnCode = cgiReturnCode - 0; 
		switch (cgiReturnCode) { case 0: case -102: case -103: case -105: case -300: case -301: res = true; break; default: res = false; break; }
		return res;
	}, 
	getPURL: function(uin, size) { 
		return QZONE.FP.getPURL(uin, size); 
	}, 
	getSnapshot: function(finger, type, docid, route, callback, errCallback) {
		var snapshotstat = g_Parent.TCISD.createTimeStat("qzonesosoSnapshot", [175, 201, 1]); 
		snapshotstat.setZero(); 
		var data = { uin: g_Uin, finger: finger, businesstype: type, segstr: qs.Parameters.segstr, searchid: qs.getSearchId(), entry: 16 }; 
		if (null != docid && undefined != docid && "undefined" != docid && "" != docid) { data.docid = docid; }
		if (null != route && undefined != route && "undefined" != route && "" != route) { data.route = route; }
		var jg = new QZFL.JSONGetter(qs.URL.snapshot, "snapshot", data, "utf-8"); 
		var ts = new Date(); 
		jg.onSuccess = function(o) {
			var te = new Date(); 
			if (qs.cgiReturnStatic(o.ret)) { 
				g_Parent.TCISD.valueStat(400087, 1, 13, { duration: (te - ts) }); 
			} else { 
				g_Parent.TCISD.valueStat(400087, 3, 15, { duration: (te - ts) }); 
			}
			if (o && o.ret == 0) { 
				snapshotstat.mark(17); 
				if (typeof (callback) == "function") { 
					callback(o); 
				} 
			} else { 
				errCallback && errCallback(o); 
				if (!qs.cgiReturnStatic(o.ret)) { 
					var errData = { searchType: 1, searchID: o.searchid, errorCode: o.ret, msg: o.msg, errorCodeSoso: o.errorcode_soso, msgSoso: o.msg_soso }; qs.errorLog(errData); 
				} 
			} 
		}; 
		jg.onError = function() { 
			var te = new Date(); 
			g_Parent.TCISD.valueStat(400087, 2, 14, { duration: (te - ts) }); 
			errCallback && errCallback();
			var errData; 
			errData = { searchType: 1, searchID: data.searchid, errorCode: -900, msg: 'JSON error or HTTP/CGI error' }; 
			qs.errorLog(errData); }; 
			jg.send("callback");
	}, 
	getSnapshotErrCallback: function(o) {
		var map = qs.errMap; 
		if (o) {
			if (o.ret == -300) {
				QZONE.FP.hideMsgbox(); 
				QZONE.FP.showLoginBox("qzonesoso", function() { location.reload(); })
				return;
			} else { 
				QZONE.FP.showMsgbox(map[o.ret] ? map[o.ret] : "系统繁忙", 5, 2000); 
			} 
		} 
	}, 
	presentUserInfo: function(dom, type, opt) { 
		qs.UserInfo.presentUserInfo(dom, type, opt); 
	}, 
	setCommentStatus: function(elBtn, finger) {
		var txt = elBtn.innerHTML, elComment = $('comment_' + finger); 
		if (txt == '收起评论') { 
			setTimeout(function() { 
				QZFL.css.addClassName(elComment, 'none'); 
			}, 5); 
			elBtn.innerHTML = '评论'; 
		} else { 
			QZFL.css.removeClassName(elComment, 'none'); 
			elBtn.innerHTML = '收起评论'; 
		} 
	}, 
	sendClickRequest: function(opt) {
		var opt = opt || {}; 
		if ('undefined' == typeof opt.entry) { opt.entry = 35 }
		var data = { uin: g_Uin, entry: opt.entry }; 
		var jg = new QZFL.JSONGetter(qs.URL.snapshot, null, data, "utf-8"); 
		jg.onSuccess = function(o) { }; 
		jg.onError = function() { }; 
		jg.send("callback");
	}, 
	brStat: function() {
		var v = 0, brType = '', b = {}; 
		if (v = QZFL.userAgent.ie) { brType = 'IE'; } 
		else if (v = QZFL.userAgent.firefox) { brType = 'Firefox'; } 
		else if (v = QZFL.userAgent.chrome) { brType = 'Chrome'; } 
		else if (v = QZFL.userAgent.opera) { brType = 'Opera'; } 
		else if (v = QZFL.userAgent.safari) { brType = 'Safari'; }
		b.type = brType; 
		b.version = v; 
		return b;
	}, 
	errorLog: function(data) { 
		var b; 
		b = qs.brStat(); 
		data.browserType = b.type; 
		data.browserVersion = b.version; 
		qs._sendLogRequest(data); 
	}, 
	_sendLogRequest: function(params) { 
		var data = { 
				uin: isUndefined(params.uin) ? g_Parent.g_iLoginUin : params.uin, 
				searchtype: isUndefined(params.searchType) ? 0 : params.searchType, 
				searchid: isUndefined(params.searchID) ? '0' : params.searchID, 
				errorcode: isUndefined(params.errorCode) ? 0 : params.errorCode, 
				msg: isUndefined(params.msg) ? "UNDEFINED_MSG" : encodeURIComponent(params.msg), 
				errorcode_soso: isUndefined(params.errorCodeSoso) ? 0 : params.errorCodeSoso, 
				msg_soso: isUndefined(params.msgSoso) ? "UNDEFINED_MSG" : encodeURIComponent(params.msgSoso), 
				browsertype: isUndefined(params.browserType) ? "OTHER" : encodeURIComponent(params.browserType), 
				browserversion: isUndefined(params.browserVersion) ? "0" : encodeURIComponent(params.browserVersion) 
		}; 
		var jg = new QZFL.JSONGetter(qs.URL.errlog, null, data, "utf-8"); 
		jg.onSuccess = function(o) { }; 
		jg.onError = function() { }; 
		jg.send("callback"); 
	}, 
	PV: function(path, opt) { 
		if (path) { 
			qs.tcssPV(path); 
			qs.sosoPV(qs.searchid, path, opt); 
		} 
	}, 
	tcssPV: function(path, domain) { 
		domain = domain || 'searchact'; 
		g_Parent.TCISD.pv(domain + '.qzone.qq.com', '/' + path); 
	}, 
	sosoPV: function(searchid, path, opt) {
		var data = { uin: g_Uin, searchid: searchid || '', path: path || '' }; 
		if ('object' == typeof opt) { for (var key in opt) { data[key] = opt[key]; } }
		var jg = new QZFL.JSONGetter(qs.URL.sosopv, null, data, 'utf-8'); 
		jg.onSuccess = function(o) { }; 
		jg.onError = function() { }; 
		jg.send('callback');
	}, 
	setEntry: function(id) { 
		qs.Parameters.entry = id; 
	}, 
	setLogo: function(dom) {
		var styleNonIE6 = 'background:url(http://{siDomain}/qzonestyle/qzone_client_v5/proj_search/{logo}.png);', 
			styleIE6 = 'background:none;filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=noscale, src=\'http://{siDomain}/qzonestyle/qzone_client_v5/proj_search/{logo}.png\');', 
			style, a, b, isDeepStyleFlag; 
		isDeepStyleFlag = isDeepStyle(); 
		style = QZFL.userAgent.ie == 6 ? styleIE6 : styleNonIE6; 
		style = format(style, { siDomain: g_Parent.siDomain, logo: (isDeepStyleFlag ? "logo_soso_dark" : "logo_soso") }); 
		if (a = $("logo_top")) { a.style.cssText = style; }
		if (b = $("logo_bottom")) { b.style.cssText = style; }
		if (c = $("soso_logo_top")) { 
			if (isDeepStyleFlag) { 
				QZFL.css.addClassName(c, "logo_dark"); 
			} else { 
				QZFL.css.removeClassName(c, "logo_dark"); 
			} 
		} 
	}, 
	toPage: function(type, keyword, opt) {
		qs.setScrollTopByTab(); 
		var canvas = { "7": "home.html", "1": "blog.html", "2": "mood.html", "-1": "soren.html" }, t, param, opt = opt || {}; 
		if (qs._useNewSoren()) { 
			canvas[-1] = "new_soren.html"; 
			if ('soren' == type) { 
				type = 'new_soren'; 
			} 
		}
		qs.Parameters.sort = 0; 
		qs.Parameters.resultset = 0; 
		qs.Parameters.daynum = 0; 
		param = { mix: qs.Parameters.mix, 
				search: keyword ? keyword : qs.Parameters.search, 
			entry: opt.entry ? opt.entry : qs.Parameters.entry, 
			daynum: isUndefined(opt.daynum) ? qs.Parameters.daynum : opt.daynum, 
			resultset: isUndefined(opt.resultset) ? qs.Parameters.resultset : opt.resultset, 
			sort: isUndefined(opt.sort) ? qs.Parameters.sort : opt.sort 
		}; 
		if (!isUndefined(opt.webbox)){ 
			param.webbox = decodeURIComponent(opt.webbox);
		}
		if (256 < QZFL.string.getRealLen(param.search)) { 
			param.search = QZFL.string.cut(param.search, 256); 
		}
		location.href = (canvas[type] ? canvas[type] : type + '.html') + '?' + genHttpParamString(param);
	}, 
	getCurrentSearchWords: function() { 
		var searchWordsContainer = $('search_keyword'); 
		var searchWords; 
		if (searchWordsContainer) { 
			searchWords = searchWordsContainer.value; 
			return searchWords; 
		} else { 
			return qs.Parameters.search;
		} 
	}, 
	onFilterToggled: QZFL.emptyFn, 
	getStr: function(str) { return "'" + str + "'"; }, 
	getMaxStr: function(str, max) {
		str = QZFL.string.restHTML(str); 
		if (QZFL.string.getRealLen(str) < max) { return escHTML(str); }
		newStr = QZFL.string.cut(str, max - 3, "..."); 
		return QZFL.string.escHTML(newStr);
	}, 
	onListOver: function(el) { 
		QZFL.css.addClassName(el, "bg3"); 
	}, 
	onListOut: function(el) { 
		QZFL.css.removeClassName(el, "bg3"); 
	}, 
	showCount: function(count) {
		var resultNumText = ""; 
		countFormat = qs._formatNum(count); 
		resultNumText = '约' + countFormat + '条结果'; 
		if (0 == count || '0' == count) { resultNumText = count + '条结果' }
		$("result_count").innerHTML = resultNumText;
	}, 
	_formatNum: function(num) {
		var re1, re2; 
		re1 = /^(\+|-)?\d+(\.\d+)?$/; if (!re1.test(num)) { return num; }
		var re2 = new RegExp(); 
		re2.compile("(\\d)(\\d{3})(,|\\.|$)"); num += ""; 
		while (re2.test(num))
			num = num.replace(re2, "$1,$2$3")
		return num;
	}, 
	setReturnURL: function() { 
		var p = qs.Parameters; 
		if ("undefined" != p.appname && "undefined" != p.backurl && undefined != p.appname && undefined != p.backurl) { 
			var olink = $e('#return_link'); 
			olink.setHtml(decodeURIComponent('返回' + p.appname)); 
			olink.unBind("click"); 
			olink.bind("click", function() { 
				QZONE.FP.toApp(decodeURIComponent(p.backurl)); 
				return false; 
			}); 
		} 
	}, 
	_useNewSoren: function() { return true; }, 
	setScrollTopByTab: function() {
		var p = $e(frameElement).getXY(), t = p[1], scrollY = QZFL.dom.getScrollTop(parent.document); 
		if (6 != QZFL.userAgent.ie) { t = t - 34; }
		if (t < scrollY){ 
			QZONE.FP.setScrollTop(t); 
		} 
	}, 
	getSearchId: function() { 
		return g_Uin + '_' + (new Date().getTime()) + '_' + Math.floor(Math.random() * 10000000000); 
	} 
}; 

qs.Extend = { GuessWords: { element: $("search_guess"), present: function(data) {
    var p = qs.Extend.GuessWords; if (!data || data.length == 0) { p.hide(); return; }
    if (p.element) { p.element.innerHTML = tmpl("tmpl_guess", { data: data }) }
    p.show();
}, show: function() { qs.Extend.GuessWords.element.style.display = ""; }, hide: function() { qs.Extend.GuessWords.element.style.display = "none"; } 
}, similarWords: { genDataFromHotwords: function(data) {
    var list = shuffleArray(data).slice(0, 10), ar = []; for (var i = 0, len = list.length; i < len; i++) { ar.push({ word: list[i].title }); }
    return ar;
}, present: function(data, showHotwords, showRight) {
    var p = qs.Extend.similarWords; if (showHotwords !== false) { showHotwords = true; }
    if (showRight !== false) { showRight = true; }
    if (!data && true == showHotwords) { if (qs.HotSearch.data) { p._present(p.genDataFromHotwords(qs.HotSearch.data), 1); return; } }
    p._present(data); p._presentRight(data, showRight);
}, _present: function(data, type) {
    var el = $("search_related"), _data = QZFL.extend([], data), arr = [], singleFlag = false, count = 2, type = type || 0; QZFL.css.removeClassName(el, "single_line"); if (_data && _data.length > 0) {
        if (_data.length < 5) { singleFlag = true; count = 1; }
        while (_data.length) { arr.push(_data.splice(0, count)); }
        el.innerHTML = tmpl("tmpl_similarwords_bottom", { data: arr, type: type }); singleFlag && (QZFL.css.addClassName(el.childNodes[1], "single_line")); QZFL.css.removeClassName(el, "none");
    }
    else { QZFL.css.addClassName(el, "none"); } 
}, _presentRight: function(data, showRight) { var el = $e("#widget_similarwords"), _data = QZFL.extend([], data); if (showRight && _data.length > 0) { _data = _data.slice(0, 6); el.setHtml(tmpl("tmpl_similarwords_right", { data: _data })); el.show(); } else { el.hide(); } } 
}, BottomSearch: { element: $("search_bottom_bar"), mainContainer: $("main_container"), inputBox: $("search_bottom_keyword"), hide: function() { QZFL.css.addClassName(this.element, "none"); }, show: function() { QZFL.css.removeClassName(this.element, "none"); }, present: function() {
    var th = qs.Extend.BottomSearch; if (th.mainContainer.offsetHeight > 700) { th.show(); }
    else { th.hide(); } 
}, doSearch: function(opt) {
    var b = qs.Extend.BottomSearch, t = qs.Extend.TopSearch; opt = opt || {}; qs.Parameters.search = t.inputBox.value = b.inputBox.value; if (undefined != opt.entry) { qs.Parameters.entry = opt.entry; } else { qs.Parameters.entry = 15; }
    qs.doSearch();
}, searchInputKeydown: function() { var b = qs.Extend.BottomSearch, e = QZFL.event.getEvent(event); if (e.keyCode == '13') { qs.PV('results-bottom'); b.doSearch(); } } 
}, TopSearch: { inputBox: $("search_keyword"), smartBox: null, initSmartBox: function(smartType) { var t = qs.Extend.TopSearch; if (t.smartBox == null) { QZFL.imports("http://" + g_Parent.siDomain + "/qzone/v6/navigation/navigation_search_2.0.js", function() { var smartOpt = { 'id': 'result_top', 'smartType': smartType, 'searchBtn': $('search_btn'), 'inputBox': $('search_keyword'), 'offsetLeft': ua && ua.ie ? -1 : -1, 'offsetTop': ua && ua.ie ? 1 : 1, 'showMore': false, 'containerWidth': 525, 'doSearch': function(keywords, entry) { qs.Extend.TopSearch.setValue(keywords); qs.setEntry(entry); qs.doSearch(); }, searchidObj: qs }; t.smartBox = new QZONE.Search(); t.smartBox.init(smartOpt); }); } }, setValue: function(val) { var t = qs.Extend.TopSearch, b = qs.Extend.BottomSearch; b.inputBox.value = t.inputBox.value = val; }, getValue: function() { var th = qs.Extend.TopSearch; return th.inputBox.value; } }, Tips: { element: $('search_no_result'), show: function(msg) { var d = qs.Extend.Tips.element; d.innerHTML = msg; d.style.display = ''; }, hide: function() { qs.Extend.Tips.element.innerHTML = ''; qs.Extend.Tips.element.style.display = 'none'; } }, noResult: { hideOtherElements: function() {
    if ($('result_friend')) { $('result_friend').innerHTML = ''; QZFL.css.addClassName($('result_friend'), "none"); }
    if ($('result_other')) { $('result_other').innerHTML = ''; QZFL.css.addClassName($('result_other'), "none"); }
    if ($('result_list')) { $('result_list').innerHTML = ''; QZFL.css.addClassName($('result_list'), "none"); }
    if ($('#search_more_friend')) $e('#search_more_friend').hide(); if ($('result_list')) $('result_list').innerHTML = ''; $('search_pagenav') && ($('search_pagenav').style.display = 'none'); $('search_bottom_bar') && ($('search_bottom_bar').style.display = 'none'); $('search_guess') && ($('search_guess').style.display = 'none'); qs.Interface.Mood.hide(); $('myMood') && ($('myMood').style.display = 'none'); $('bingo') && ($('bingo').className = 'none');
}, showTips: function(code, type) {
    var m; var allURL = ''; var filterConditionText = qs.Filter.conditions2Text(); allURL = '<a class="c_tx" href="javascript:;" onclick="qs.PV(\'none-renew\');qs.Parameters.resultset=0;qs.Parameters.daynum=0;qs.toPage(\'home\', \'' + QZFL.string.escHTML(QZFL.string.escString(qs.Parameters.search)) + '\', {entry:59});return false;">查看全部结果</a>'
    if (undefined == code) { code = -102; }
    if (undefined == type) { type = 'other'; }
    if (-102 == code) {
        if ("" == QZFL.string.trim(qs.Parameters.search)) { m = '搜索词为空，请输入内容后再次搜索'; } else if (128 < QZFL.string.getRealLen(qs.Parameters.search)) { m = '搜索词超过规定长度，请缩减内容后再次搜索'; } else {
            if ('soren' == type) {
                if (qs._useNewSoren()) {
                    m = '抱歉，找不到与“<span class="c_tx4">' + escHTML(QZFL.string.trim(qs.Parameters.search)) + '</span>”相符的用户'; allURL1 = '<a class="c_tx" href="javascript:;" onclick="qs.PV(\'soren_none_clear\');qs.Parameters.resultset=0;qs.Parameters.daynum=0;qs.toPage(&quot;soren&quot;, &quot;' + QZFL.string.escHTML(QZFL.string.escString(qs.Parameters.search)) + '&quot;, {entry:59});return false;">清空筛选条件</a>'
                    allURL2 = '<a class="c_tx" href="javascript:;" onclick="qs.PV(\'soren_none_allcontent\');qs.Parameters.resultset=0;qs.Parameters.daynum=0;qs.toPage(\'home\', \'' + QZFL.string.escHTML(QZFL.string.escString(qs.Parameters.search)) + '\', {entry:59});return false;">查看全部结果</a>'
                    m += '，您可以' + allURL1 + '或' + allURL2;
                } else { m = '抱歉，找不到与“<span class="c_tx4">' + escHTML(QZFL.string.trim(qs.Parameters.search)) + '</span>”相符的用户'; m += '，您可以' + allURL; } 
            } else { m = '抱歉，找不到与“<span class="c_tx4">' + escHTML(QZFL.string.trim(qs.Parameters.search)) + '</span>”相符'; m += filterConditionText + '的结果' + '，您可以' + allURL; } 
        } 
    } else if (-103 == code) { m = '抱歉，搜索结果可能不符合相关法规、政策，未予显示'; } else if (-901 == code) { m = '请先填写搜索词或选择筛选条件'; } else if (-105 == code) { if ('soren' == type) { m = '抱歉，您的搜索过于频繁，请稍后再试'; } } else { if ('soren' == type) { m = '抱歉，找不到与“' + escHTML(QZFL.string.trim(qs.Parameters.search)) + '”相符的用户'; } else { m = '拉取数据失败，请稍后再试'; } }
    qs.Extend.noResult.hideOtherElements(); qs.Extend.Tips.show(m);
}, hideTips: function() { qs.Extend.Tips.hide(); $('search_pagenav').style.display = ''; $('search_bottom_bar').style.display = ''; if (0 < $e('#myMood').getChildren().elements.length) { $('myMood') && ($('myMood').style.display = ''); } } 
}, ChangeUp: { up: function(target) {
    var finger = qs.Parameters.finger, el, fingerData, item; if (finger && finger != -1) {
        el = $("finger_" + finger); fingerData = g_Parent.QZONE.FrontPage.dataLoad("qzone_soso_ic_blog"); if (fingerData) { item = qs.Extend.ChangeUp.searchItemByFinger(finger, fingerData); }
        qs.Parameters.finger = -1; if (!el) { item && (el = qs.Extend.ChangeUp.createFingerItem(item)); }
        if (el) {
            target.insertBefore(el, target.childNodes[0])
            if (item && item.type == 1) { setTimeout(function() { qs.Blog.showBlogContent(item.key, item.finger, null, item.docid, item.route); }, 0); } 
        };
    } 
}, createFingerItem: function(item) { var elOl = document.createElement("ol"); elOl.innerHTML = tmpl("tmpl_result", { data: { resultdata: [item]} }); return QZFL.dom.getFirstChild(elOl); }, searchItemByFinger: function(finger, list) {
    for (var i = 0, len = list.length; i < len; i++) { if (list[i].finger == finger) { return list[i]; } }
    return null
} 
}, UtilFeed: { currentFriendsResultNum: 0, maxFriendsResultNum: 5, getFriendResultCount: function(data) {
    var qsEUF = qs.Extend.UtilFeed, count = 0, max = qsEUF.maxFriendsResultNum; for (var i = 0, len = data.length > max ? max : data.length; i < len; i++) {
        if (data[i].isFriend) { count++; }
        else { break } 
    }
    return count;
}, getAllFriendResultCount: function(o) {
    var data = o.data.businessdata; for (var i = 0, len = data.length; i < len; i++) { if (data[i].type == 0) { return data[i].estimateNum; } }
    return 0;
}, hideFriendResult: function() { var d = $("result_friend"); d.innerHTML = ''; QZFL.css.addClassName(d, "none"); $e("#search_more_friend").hide(); }, presentFriendResult: function(data, count, allcount) { var d, t; if (d = $("result_friend")) { d.innerHTML = tmpl("tmpl_result", { data: { friendlist: data.data.resultdata.splice(0, count)} }); QZFL.css.removeClassName(d, "none"); qs.presentUserInfo(d, "nickname"); qs.presentUserInfo(d, "vip2"); qs.initNamecard(d); QZFL.css.removeClassName(d, "none"); if (allcount > count) { $('all_friends_reuslt_num').innerHTML = (allcount > 50 ? '50+' : allcount); $e("#search_more_friend").show(); qs.PV('result-morefriends-exp'); } else { $e("#search_more_friend").hide(); } } }, presentOtherResult: function(data, allcount, showFriend) {
    var qsEUF = qs.Extend.UtilFeed, d = $("result_other"); if (d) {
        var shouldShowHideLink = false; if (!showFriend && allcount > qsEUF.currentFriendsResultNum && pn.pIndex < 2) { shouldShowHideLink = true; }
        d.innerHTML = tmpl("tmpl_result", { data: data.data, currentFriendsResultNum: qsEUF.currentFriendsResultNum, shouldShowHideLink: shouldShowHideLink }); QZFL.css.removeClassName(d, "none"); qs.presentUserInfo(d, "nickname"); qs.presentUserInfo(d, "vip2"); qs.initNamecard(d);
    } 
}, hideOtherResult: function() { var d; if (d = $("result_other")) { d.innerHTML = ""; QZFL.css.addClassName(d, "none"); } } }
}; qs.Interface = { Mood: { lastSearch: null, moodPoster: null, moodContainer: $('moodContainer') || null, moodPosterContainer: $('moodPosterContainer') || null, myMoodContainer: $('myMood') || null, init: function(params) {
    var _this = qs.Interface.Mood; if (null == _this.moodPosterContainer) { return; }
    params = params || {}; QZFL.css.addClassName(_this.moodContainer, 'fn_mood bgr3'); $e(_this.moodPosterContainer).show(); if (!_this.moodPoster || _this.lastSearch != qs.Parameters.search) { _this._importJS(params); _this.lastSearch = qs.Parameters.search; } 
}, hide: function() { var _this = qs.Interface.Mood; QZFL.css.removeClassName(_this.moodContainer, 'fn_mood bgr3'); $e(_this.moodPosterContainer).hide(); }, _importJS: function(params) { var _this = qs.Interface.Mood; var jsURLs = []; var jsBaseURL = 'http://' + g_Parent.siDomain; QZFL.imports(jsBaseURL + '/qzone/app/f4a/F4A_1.2.lite.js', function() { var ver = (g_Parent.QM && g_Parent.QM.MoodPoster && g_Parent.QM.MoodPoster.ver) ? g_Parent.QM.MoodPoster.ver : ''; QZFL.imports(jsBaseURL + '/qzone/app/controls/moodPoster/moodPoster_packed_2.3.js?max_age=31536000&ver=' + ver, function() { _this._importedCallback(params); }); }); }, _importedCallback: function(params) {
    var _this = qs.Interface.Mood; QZFL.css.insertCSSLink(['http://', F4A.FP.getBase().siDomain, '/qzonestyle/qzone_client_v5/pop_icenter/pop_mood_edit.css'].join('')); var myCaller = 'soso_all'; if (params && params.caller) { myCaller = params.caller; }
    _this.moodPoster = new F4A.controls.MoodPoster({ restoreContent: false, showHeader: false, defaultContent: params.content, slogan: params.guiding, config: { caller: myCaller }, post_onSuccess: function(feedInfo) { QZONE.FP.showMsgbox('发表成功', 4, 2000); _this._postSuccessCallback(feedInfo); } }); _this.moodPoster.renderAt($e(_this.moodPosterContainer).find('div').eq(0));
}, _postSuccessCallback: function(feedInfo) { var _this = qs.Interface.Mood, oFeed; if (feedInfo) { oFeed = _this._parseData(feedInfo); $e(_this.myMoodContainer).show(); _this.append(oFeed); } }, _parseData: function(feedInfo) {
    var data = { uin: feedInfo.t1_uin, time: feedInfo.t1_ntime, type: 2, isFriend: 0, key: feedInfo.t1_tid, title: '', richtype: feedInfo.richtype, url1: feedInfo.url1, url2: feedInfo.url2, url3: feedInfo.url3, frienddata: new Array() }; data.finger = data.key + Math.random().toString().replace(/0\./, '_'); if (1 == data.richtype) { data.url1 = feedInfo.pic[0].url1; data.url2 = feedInfo.pic[0].url2; data.url3 = feedInfo.pic[0].url3; }
    var searchWords = qs.Parameters.search; var searchWord = searchWords.split('|', 1).join(''); searchWord = searchWord.replace(/\s+/g, " "); var reg = new RegExp(searchWord, 'g'); data.text = feedInfo.content.replace(reg, '<span class="c_tx4">' + searchWord + '</span>'); return data;
}, append: function(oFeed, maxNum) {
    var container = $('myMood'); var maker = $('feedMaker'); var data = {}; var existedFeedNum; var lastChild; data.resultdata = [oFeed]; existedFeedNum = $e('#myMood').find('li').elements.length; maker.innerHTML = tmpl("tmpl_result", { data: data }); if (undefined == maxNum) { maxNum = 3; }
    var firstElement = QZFL.dom.getFirstChild(container); var newElement = QZFL.dom.getFirstChild(maker); if (firstElement) { $e(newElement).insertBefore(firstElement); if (undefined != maxNum && existedFeedNum == maxNum) { lastElement = $e('#myMood').find('li').elements[existedFeedNum]; QZFL.dom.removeElement(lastElement); } } else { $e(newElement).appendTo(container); }
    qs.presentUserInfo(container, "nickname"); qs.presentUserInfo(container, "vip2"); qs.initNamecard(container);
} 
}, Share: { sendShareFeed: function(shareData, opt, succCallback, errCallback) {
    shareData.uin = shareData.uin ? shareData.uin : g_Uin; shareData.site = shareData.site ? shareData.site : '空间搜索'; shareData.type = shareData.type ? shareData.type : 21; shareData.url = shareData.url ? shareData.url : 'http://rc.qzone.qq.com/qzonesoso/isfromic=1&businesstype=all&entry=' + (opt.entryID ? opt.entryID : '72') + '&search=' + encodeURIComponent(shareData.keyword); var fs = new QZFL.FormSender('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshareadd_url2', 'post', shareData, 'utf-8'); fs.onSuccess = function(o) {
        if (succCallback)
            succCallback();
    }; fs.onError = function() {
        if (errCallback)
            errCallback();
    }; fs.send();
} }
}; qs.Blog = { showVerifycodeDlg: function(nType, procFunc) {
    var strHTML = '<iframe frameborder="no" id="verifycodeFrame" style="width:100%;height:160px;" src="/qzone/verifycode.html?imgcode=' + BLOG_VERIFY_CODE + '&type=' + nType + '"></iframe>'; try { QZONE.FP.closePopup(); }
    catch (err) { }
    parent.window.setTimeout(function() { parent.popupCallback = function(verifycode) { if (!!verifycode) { procFunc(verifycode); } }; QZONE.FP.popupDialog('请输入验证码', strHTML, 270, 159); }, 300);
}, VerifycodeType: { 'NEEDCODE': 0, 'ERRCODE': 1, 'IPC_CHECK': 2, 'NORMALCODE': 3 }, showBlogContent: function(id, finger, type, docid, route) {
    var _this = qs.Blog, el = $('blog_content_' + finger), html = _this._blogContentCache[finger]; function callback(o, fromCache) { QZONE.FP.hideMsgbox(); _this._showBlogContent(finger, fromCache ? o : o.data.snapshot, fromCache); _this.showAndHideDetail(finger); }
    if (el) { if (html) { callback(html, true); } else { QZONE.FP.showMsgbox('正在请求数据&hellip;', 6, 4000); qs.getSnapshot(finger, type, docid, route, callback, qs.getSnapshotErrCallback); } } 
}, hideBlogContent: function(finger) { $('blog_content_' + finger).innerHTML = ''; this.showAndHideDetail(finger, true); this.setScrollTopByTitle(finger); }, _blogContentCache: {}, clearBlogContentCache: function() { this._blogContentCache = {}; }, _showBlogContent: function(finger, snapshot, fromCache) {
    var elContent = $('blog_content_' + finger); if (!fromCache) { snapshot = this.parseSnapshot(snapshot); this._blogContentCache[finger] = snapshot; }
    elContent.innerHTML = snapshot; if (!fromCache) { var snapshotstat = g_Parent.TCISD.markTime(18, 'qzonesosoSnapshot'); snapshotstat.report(); } 
}, showAndHideDetail: function(finger, hide) { var elContent = $('blog_content_' + finger), elSummary = $('blog_summary_' + finger), elPic = $('blog_pic_' + finger), elShowmore = $('blog_btn_showmore_' + finger), elHidemore = $('blog_btn_hidemore_' + finger), elBtnspanel = $('blog_btnspanel_' + finger); if (hide) { elPic && (elPic.style.display = ''); elShowmore && (elShowmore.style.display = ''); elHidemore.style.display = 'none'; elSummary.style.display = ''; elContent.style.display = 'none'; elBtnspanel.style.display = 'none'; } else { elPic && (elPic.style.display = 'none'); elShowmore && (elShowmore.style.display = 'none'); elHidemore.style.display = ''; elSummary.style.display = 'none'; elContent.style.display = ''; elBtnspanel.style.display = ''; } }, parseSnapshot: function(snapshot) {
    var regImg = /<img(.*?)(src=['"].*?['"])(.*?)>/ig, regEmbed = /<embed.*?\/?>/ig, regWidth = /width=['"](.*?)['"]/i, regHeight = /height=['"](.*?)['"]/i, regWmode = /wmode=['"].*?['"]/i; snapshot = snapshot.replace(regImg, '<img onload="qs.Blog.adjustImageSize(this, 540, 540)" $2 />'); snapshot = snapshot.replace(regEmbed, function(embed) {
        var match = embed.match(regHeight); var height = match ? ((RegExp.$1 || -1) - 0) : -1, heigthStr = match ? match[0] : ''; newHeight = -1; embed = embed.replace(regWidth, function(m) {
            var width = (RegExp.$1 || -1) - 0; if (width > 540) {
                if (height > -1) { newHeight = height * (540 / width); }
                return 'width="540"';
            } else { return m; } 
        }); if (newHeight > -1) { embed = embed.replace(heigthStr, 'height="' + newHeight + '"'); }
        match = embed.match(regWmode); if (match) { embed = embed.replace(match[0], 'wmode="opaque"'); } else { embed = embed.replace('<embed', '<embed wmode="opaque"') }
        return embed;
    }); return snapshot;
}, setScrollTopByTitle: function(finger) {
    var pe = $e('#finger_' + finger).getXY(), pf = $e(frameElement).getXY(), t = pe[1] + pf[1], scrollY = QZFL.dom.getScrollTop(parent.document); if (6 != QZFL.userAgent.ie) { t = t - 34; }
    if (t < scrollY) { QZONE.FP.setScrollTop(t); } 
}, shareBlog: function(blogid, uin, docid) {
    var url = "http://" + g_Parent.imgcacheDomain + "/qzone/app/qzshare/popup.html?params={type:1,spaceuin:" + uin + ",blogid:" + blogid + "}"; QZONE.FP.popupDialog("分享", { src: url }, 408, 300); var clickopt = { 'p1': docid, 'actiontype': 1 }
    qs.PV("shareblog", clickopt);
}, quoteBlog: function(blogid, uin, docid, verifycode) {
    var data = { blogid: blogid, fromuin: uin, uin: g_Uin }; verifycode && (data.verifycode = verifycode); var sender = new QZFL.XHR("http://b.qzone.qq.com/cgi-bin/blognew/blog_quote?g_tk=" + QZONE.FP.getACSRFToken(), "qzone_soso_quote_blog", "post", data, "GB2312"); sender.onSuccess = function(data) {
        var succ = XMLselectSingleNode(data.xmlDom, "succ"); if (succ) { QZONE.FP.showMsgbox("转载成功", 4, 2000); }
        else {
            var err = XMLselectSingleNode(data.xmlDom, "error"), type; if (err && (type = err.getAttribute("type"))) {
                function verifyHandler(verifycode) { qs.Blog.quoteBlog(blogid, uin, docid, verifycode); }
                qs.Blog.needVerify(type, getXMLNodeText(err), verifyHandler);
            } else { QZONE.FP.showMsgbox(getXMLNodeText(err), 5, 2000); return; } 
        } 
    }; sender.onError = function() { QZONE.FP.showMsgbox("系统繁忙", 5, 2000); }; sender.send(); var clickopt = { 'p1': docid, 'actiontype': 1 }
    qs.PV("fowardblog", clickopt);
}, needVerify: function(type, msg, handler) { switch (type) { case "ipc_check": qs.Blog.showVerifycodeDlg(qs.Blog.VerifycodeType.IPC_CHECK, handler); break; case "verify code": qs.Blog.showVerifycodeDlg(qs.Blog.VerifycodeType.ERRCODE, handler); break; case "need_verify": qs.Blog.showVerifycodeDlg(qs.Blog.VerifycodeType.NEEDCODE, handler); break; default: QZONE.FP.showMsgbox(msg, 5, 2000); break; } }, adjustImageSize: function(image, iwidth, iheight) {
    var ow = image.width, oh = image.height; if (ow > 0 && oh > 0) {
        if (ow / oh >= iwidth / iheight) {
            if (ow > iwidth) { image.width = iwidth; image.height = (oh * iwidth) / ow; }
            else { image.width = ow; image.height = oh; } 
        }
        else {
            if (oh > iheight) { image.height = iheight; image.width = (ow * iheight) / oh; }
            else { image.width = ow; image.height = oh; } 
        } 
    } 
}, getComment: function(id, uin, finger, elBtn) {
    var elCommment, txt; if (elBtn.isInited) { qs.setCommentStatus(elBtn, finger); return; }
    var jsBaseURL = 'http://' + g_Parent.siDomain; QZFL.imports(jsBaseURL + '/qzone/app/f4a/F4A_1.2.lite.js', function() { if (!F4A.controls.SensibleEditor) { QZFL.imports(jsBaseURL + '/qzone/app/controls/sensibleEditor/sensibleEditor_2.1.js', function() { qs.Blog._importCommentModule(qs.Blog._getComment, id, uin, finger, elBtn); }); } else { qs.Blog._importCommentModule(qs.Blog._getComment, id, uin, finger, elBtn); } });
}, _importCommentModule: function(callback) { var callbackArgs = []; for (var i = 1; i < arguments.length; i++) { callbackArgs.push(arguments[i]); }; var jsBaseURL = 'http://' + g_Parent.siDomain, commentModuleJS = [jsBaseURL + '/qzone/app/controls/commentModule/commentModule_1.3.js', jsBaseURL + '/qzone/app/controls/commentModule/commentModule.models.js']; QZFL.imports(commentModuleJS, function() { callback && callback.apply(qs.Blog, callbackArgs); }); }, _getComment: function(id, uin, finger, elBtn) {
    if ('undefined' != (typeof User)) { User.current = new User({ uin: g_Uin, nickname: g_LoginInfo[6] ? QZFL.string.restHTML(g_LoginInfo[6]) : g_Nickname, avatarUrl: qs.getPURL(g_Uin, 50) }); }
    var url = "http://b.qzone.qq.com/cgi-bin/blognew/blog_get_data?g_tk=" + QZONE.FP.getACSRFToken(), jg, data; data = { uin: uin, blogid: id, from: 0, num: 10, type: 2, r: Math.random() }
    jg = new QZFL.JSONGetter(url, "qzone_soso_blog_" + id, data, "gb2312"); jg.onSuccess = function(o) { if (o && !o.error) { elBtn.isInited = true; qs.setCommentStatus(elBtn, finger); qs.Blog.prepareCommentListData(o, finger, uin); } else { QZONE.FP.showMsgbox(o.error.msg, 5, 2000); } }; jg.onError = function() { }; jg.send("_Callback");
}, prepareCommentListData: function(data, finger, uin) { var th = qs.Blog; data = data.data || {}; var commentInfo = {}; commentInfo.data = []; commentInfo.tid = data.blogid; commentInfo.uin = uin; commentInfo.count = data.replynum; commentInfo.finger = finger; th.renderCommentPanel(commentInfo); }, convertCommentData: function(data, ptid, puin) {
    var th = qs.Blog, replies = [], isCampus = isNaN(data.replyuin); if (typeof data.responsecontent === "object") { while (data.responsecontent.length) { replies[replies.length] = th.convertReplyData(data.responsecontent.pop(), ptid, puin, data.replyid, data.replyuin); } }
    var result = new MoodComment({ ptid: ptid, puin: puin, id: data.replyid, content: restHTML(removeUBB(data.replycontent)), poster: new User({ uin: data.replyuin, nickname: isCampus ? restXHTML(data.nickname) : restXHTML(data.replynick), avatarUrl: isCampus ? "http://xy.store.qq.com/" + data.replyuin + "0" : qs.getPURL(data.replyuin, 50) }), postTime: presentDate(data.replytime), replies: replies }); return result;
}, convertReplyData: function(data, ptid, puin, ctid, cuin) { var isCampus = isNaN(data.uin); return new MoodReply({ ptid: ptid, puin: puin, ctid: ctid, cuin: cuin, id: data.tid, content: restHTML(removeUBB(data.content)), poster: new User({ uin: data.uin, nickname: isCampus ? restXHTML(data.nick) : restXHTML(data.nick), avatarUrl: isCampus ? "http://xy.store.qq.com/" + data.uin + "0" : qs.getPURL(data.uin, 50) }), postTime: presentDate(data.time) }); }, postComment: function(content, callbacks, blogdata, verifycode) {
    var sendData = { content: content, blogid: blogdata.tid, uin: blogdata.uin, ouin: g_Uin }; verifycode && (sendData.verifycode = verifycode); var sender = new QZFL.XHR("http://b.qzone.qq.com/cgi-bin/blognew/blog_add_comment?g_tk=" + QZONE.FP.getACSRFToken(), "qzone_soso_add_comment", "post", sendData, "GB2312"); sender.onSuccess = function(data) {
        var succ = XMLselectSingleNode(data.xmlDom, "succ"); if (succ) { var commentId = succ.getAttribute('num'); callbacks.onSuccess(new MoodComment({ ptid: blogdata.tid, puin: blogdata.uin, id: commentId, content: content, poster: User.current, postTime: '刚刚' })); }
        else {
            var err = XMLselectSingleNode(data.xmlDom, "error"), type; if (err && (type = err.getAttribute("type"))) {
                if (type == 'audit_added') { QZONE.FP.showMsgbox(getXMLNodeText(err), 3, 2000); } else {
                    function verifyHandler(verifycode) { qs.Blog.postComment(content, callbacks, blogdata, verifycode) }
                    qs.Blog.needVerify(type, getXMLNodeText(err), verifyHandler);
                } 
            }
            else { QZONE.FP.showMsgbox(getXMLNodeText(err), 5, 2000); return; } 
        } 
    }; sender.onError = function() { callbacks.onError(); }; sender.send();
}, postReply: function(content, comment, callbacks, blogdata, verifycode) {
    var sendData = { replycontent: content, blogid: blogdata.tid, uin: blogdata.uin, commentid: comment._id, ouin: g_Uin }; verifycode && (sendData.verifycode = verifycode); var sender = new QZFL.XHR("http://b.qzone.qq.com/cgi-bin/blognew/blog_reply_comment?g_tk=" + QZONE.FP.getACSRFToken(), "qzone_soso_add_reply", "post", sendData, "GB2312"); sender.onSuccess = function(data) {
        var succ = XMLselectSingleNode(data.xmlDom, "succ"); if (succ) { callbacks.onSuccess(new MoodReply({ id: data.tid, content: content, ptid: comment.ptid, puin: comment.puin, ctid: comment._id, cuin: comment._poster._uin, poster: User.current, postTime: '刚刚' })); }
        else {
            var err = XMLselectSingleNode(data.xmlDom, "error"), type; if (err && (type = err.getAttribute("type"))) {
                if (type == 'audit_added') { QZONE.FP.showMsgbox(getXMLNodeText(err), 3, 2000); } else {
                    function verifyHandler(verifycode) { qs.Blog.postReply(content, comment, callbacks, blogdata, verifycode) }
                    qs.Blog.needVerify(type, getXMLNodeText(err), verifyHandler);
                } 
            }
            else { QZONE.FP.showMsgbox(getXMLNodeText(err), 5, 2000); return; }
            callbacks.onError();
        } 
    }; sender.onError = function() { callbacks.onError(); }; sender.send();
}, renderCommentPanel: function(data) { var jsBaseURL = 'http://' + g_Parent.siDomain; QZFL.imports(jsBaseURL + '/qzone/app/f4a/F4A_1.2.lite.js', function() { if (!F4A.controls.SensibleEditor) { QZFL.imports(jsBaseURL + '/qzone/app/controls/sensibleEditor/sensibleEditor_2.1.js', function() { qs.Blog._importCommentModule(qs.Blog.renderCommentPanelImportsCallback, data); }); } else { qs.Blog._importCommentModule(qs.Blog.renderCommentPanelImportsCallback, data); } }); }, _commentModules: [], clearCommentModules: function() {
    for (var i = 0, len = this._commentModules.length; i < len; i++) { this._commentModules[i].hideCommentBox(); this._commentModules[i] = null; }
    this._commentModules = [];
}, renderCommentPanelImportsCallback: function(data) {
    if ('undefined' != (typeof User)) { User.current = new User({ uin: g_Uin, nickname: g_LoginInfo[6] ? QZFL.string.restHTML(g_LoginInfo[6]) : g_Nickname, avatarUrl: qs.getPURL(g_Uin, 50) }); }
    var commentModule = new F4A.controls.CommentModule({ id: "comment_list_" + data.finger, emoticonSupported: true, showRepliesByDefault: true, showPaginationForm: false, hideReplyAvatar: false, userLinkUrlTemplate: 'javascript:void(getHomeLink(\'${uin}\', this, {target:\'_blank\'}));', userLinkTarget: "_self", defaultPageNum: 1, newlineSupported: false, showAllTarget: '_blank', showAllUrl: "http://user.qzone.qq.com/" + data.uin + "/blog/" + data.tid, avatarTemplate: '<a href="javascript:;" onclick="getHomeLink(\'${uin}\', this);return false;" ><img src="${avatarUrl}" style="width:35px; height:35px;" alt="${nickname}" /></a>' }); commentModule.setCommentTotal(data.count); commentModule.isAbleToRemove = function(obj) { return false; }; commentModule.isAbleToReply = function(obj) {
        if (obj.getId()) { return true; }
        return false;
    }; commentModule.postComment = function(content, callbacks) { qs.Blog.postComment(content, callbacks, data); }; commentModule.postReply = function(content, comment, callbacks) { qs.Blog.postReply(content, comment, callbacks, data); }; commentModule.removeComment = function(comment, callbacks) { }; commentModule.removeReply = function(reply, callbacks) { }; commentModule.onError = function(code, showHint) { switch (code) { case 'comment-too-long': showHint('评论内容太长啦~'); break; case 'comment-no-content': showHint('请输入评论内容~'); break; case 'reply-too-long': showHint('回复内容太长啦~'); break; case 'reply-no-content': showHint('请输入回复内容~'); break; } }; commentModule.onCommentNodeCreated = function(comment, commentNode) { }; commentModule.onReplyNodeCreated = function(reply, replyNode) { }; commentModule.onCommentNodeRemoved = function(comment, commentNode) { }; commentModule.onReplyNodeRemoved = function(reply, replyNode) { }; commentModule.init($("comment_listpanel_" + data.finger)); commentModule.showCommentBox(); this._commentModules.push(commentModule);
}, quoteList: function(data) {
    var arr = [], t; for (var i = 0, len = data.length; i < len; i++) {
        t = '<a class="c_tx q_nickname q_namecard" link="nameCard_{uin}" onclick="qs.PV(\'forwordblog-friends\');" href="http://user.qzone.qq.com/{uin}/blog/{buf}" target="_blank">{uin}</a>'
        arr.push((format(t, { uin: data[i].uin, buf: data[i].buf }) + (i != len - 1 ? "、" : "")));
    }
    return '<div class="rt">' + arr.join("") + ' 也发表了相关日志</div>';
} 
}; qs.Mood = { _curForwardNick: "", _curForwardCon: "", handleImgURL: function(oriURL) {
    if ('string' == typeof oriURL) { return oriURL.replace('qp.qq.com', 'p.qpimg.cn'); }
    return oriURL;
}, forward: function(moodid, uin, finger, docid, el) {
    qs.Mood.closeComment(finger); var th = qs.Mood; var el = QZFL.dom.getPreviousSibling(el.parentNode), url = "http://" + g_Parent.imgcacheDomain + "/qzone/v6/qzonesoso/richinfo_view.html#params=4," + moodid + "," + uin, t = '<iframe id="forward_iframe" src="__src__" allowtransparency="true" width="410" height="140" scrolling="no" border="0" frameborder="0"></iframe>', elForward; th.closeForward(); th._curForwardNick = getXMLNodeText($("mood_nick_" + finger)); th._curForwardCon = getXMLNodeText($("mood_con_" + finger))
    elForward = $("mood_forward_" + finger); if (elForward) { elForward.innerHTML = t.replace("__src__", url); QZFL.css.removeClassName(elForward, "none"); }
    var clickopt = { 'p1': docid, 'actiontype': 1 }
    qs.PV("fowardtweets", clickopt);
}, getCurForwardNick: function() { return this._curForwardNick; }, getCurForwardCon: function() { return this._curForwardCon; }, closeForward: function(finger) {
    var el; if (finger) {
        el = $("mood_forward_" + finger); if (el.childNodes[0]) { QZFL.css.addClassName(el, "none"); el.innerHTML = ""; }
        return;
    }
    el = $("forward_iframe"); if (el) { QZFL.css.addClassName(el.parentNode, "none"); el.parentNode.innerHTML = ""; } 
}, closeComment: function(finger) { var elBtn = $("mood_comment_button_" + finger), elComment = $("comment_" + finger); if (elBtn && elBtn.innerHTML == "收起评论") { elBtn.innerHTML = "评论"; QZFL.css.addClassName(elComment, "none"); } }, videoView: { show: function(finger, orgurl, videourl) {
    var img = $("mood_video_img_" + finger), video = $("mood_video_" + finger); img.style.display = "none"; if (!video.isInit) { video.innerHTML = tmpl("tmpl_mood_video", { finger: finger, orgurl: orgurl, videourl: videourl }); video.isInit = true; }
    video.style.display = "";
}, hide: function(finger) { var img = $("mood_video_img_" + finger), video = $("mood_video_" + finger); img.style.display = ""; video.style.display = "none"; video.innerHTML = ""; video.isInit = false; } 
}, imageView: { show: function(finger, simg, bimg) {
    var img = $("mood_image_img_" + finger), bigimg = $("mood_image_" + finger); img.style.display = "none"; if (!bigimg.isInit) { bigimg.innerHTML = tmpl("tmpl_mood_image", { finger: finger, simg: simg, bimg: bimg }); bigimg.isInit = true; }
    bigimg.style.display = "";
}, hide: function(finger) { $("mood_image_img_" + finger).style.display = ""; $("mood_image_" + finger).style.display = "none"; }, rotateRight: function(el) { var finger = el.getAttribute("param"); rotateImage($("mood_image_middle_" + finger), 90, true, finger); }, rotateLeft: function(el) { var finger = el.getAttribute("param"); rotateImage($("mood_image_middle_" + finger), -90, true, finger); } 
}, getMoodList: function(uins, callback) {
    var url = "http://" + g_Parent.g_Main_Domain + "/cgi-bin/tfriend/friend_show_emotion_and_update.cgi", jg, data; data = { uin: g_Uin, update: 1, emotion: 1, uins: uins.join("|"), g_tk: QZONE.FP.getACSRFToken() }; jg = new QZFL.JSONGetter(url, "qzone_soso_mood_list", data, "utf-8"); jg.onSuccess = function(o) {
        var data = { emotion: {}, update: {} }; if (o.emotion && o.emotion.length > 0) { var list = o.emotion, item; for (var i = 0, len = list.length; i < len; i++) { item = list[i]; data.emotion[item.uin] = item.content; } }
        if (o.update && o.update.length > 0) { var list = o.update, item; for (var i = 0, len = list.length; i < len; i++) { item = list[i]; data.update[item.uin] = item; } }
        callback && callback(data);
    }; jg.onError = function() { }; jg.send("_Callback");
}, getComment: function(id, uin, finger, elBtn) {
    qs.Mood.closeForward(finger); var elCommment, txt; if (elBtn.isInited) { qs.setCommentStatus(elBtn, finger); return; }
    var jsBaseURL = 'http://' + g_Parent.siDomain; QZFL.imports(jsBaseURL + '/qzone/app/f4a/F4A_1.2.lite.js', function() { if (!F4A.controls.SensibleEditor) { QZFL.imports(jsBaseURL + '/qzone/app/controls/sensibleEditor/sensibleEditor_2.1.js', function() { qs.Mood._importCommentModule(qs.Mood._getComment, id, uin, finger, elBtn); }); } else { qs.Mood._importCommentModule(qs.Mood._getComment, id, uin, finger, elBtn); } });
}, _importCommentModule: function(callback) { var callbackArgs = []; for (var i = 1; i < arguments.length; i++) { callbackArgs.push(arguments[i]); }; var jsBaseURL = 'http://' + g_Parent.siDomain, commentModuleJS = [jsBaseURL + '/qzone/app/controls/commentModule/commentModule_1.3.js', jsBaseURL + '/qzone/app/controls/commentModule/commentModule.models.js']; QZFL.imports(commentModuleJS, function() { callback && callback.apply(qs.Mood, callbackArgs); }); }, _getComment: function(moodid, uin, finger, elBtn) {
    if ('undefined' != (typeof User)) { User.current = new User({ uin: g_Uin, nickname: g_LoginInfo[6] ? QZFL.string.restHTML(g_LoginInfo[6]) : g_Nickname, avatarUrl: qs.getPURL(g_Uin, 50) }); }
    var url = "http://taotao.qq.com/cgi-bin/emotion_cgi_getcomments", jg, data; data = { uin: uin, tid: moodid, pos: 0, num: 10, r: Math.random() }
    jg = new QZFL.JSONGetter(url, "qzone_soso_mood_" + moodid, data, "utf-8"); jg.onSuccess = function(o) { if (o.result && o.result.post) { elBtn.isInited = true; qs.setCommentStatus(elBtn, finger); qs.Mood.prepareCommentListData(o, finger); } else { QZONE.FP.showMsgbox("拉取评论出错或用户设置了访问权限", 5, 2000); } }; jg.onError = function() { }; jg.send("_Callback");
}, prepareCommentListData: function(data, finger) { data = data.result.post || {}; var commentInfo = {}; commentInfo.data = []; commentInfo.tid = data.tid; commentInfo.uin = data.uin; commentInfo.source = data.source; commentInfo.count = data.reply_num; commentInfo.finger = finger; qs.Mood.renderCommentPanel(commentInfo); }, convertCommentData: function(data, ptid, puin) {
    var replies = []; if (typeof data.list_3 === "object") { while (data.list_3.length) { replies[replies.length] = qs.Mood.convertReplyData(data.list_3.pop(), ptid, puin, data.tid, data.uin); } }
    var result = new MoodComment({ ptid: ptid, puin: puin, id: data.tid, content: restHTML(data.content), poster: new User({ uin: data.uin, nickname: restXHTML(data.name), avatarUrl: qs.getPURL(data.uin, 50) }), postTime: data.createTime2, replies: replies }); return result;
}, convertReplyData: function(data, ptid, puin, ctid, cuin) { return new MoodReply({ ptid: ptid, puin: puin, ctid: ctid, cuin: cuin, id: data.tid, content: restHTML(data.content), poster: new User({ uin: data.uin, nickname: restXHTML(data.name), avatarUrl: qs.getPURL(data.uin, 50) }), postTime: data.createTime2 }); }, renderCommentPanel: function(data) { var jsBaseURL = 'http://' + g_Parent.siDomain; QZFL.imports(jsBaseURL + '/qzone/app/f4a/F4A_1.2.lite.js', function() { if (!F4A.controls.SensibleEditor) { QZFL.imports(jsBaseURL + '/qzone/app/controls/sensibleEditor/sensibleEditor_2.1.js', function() { qs.Mood._importCommentModule(qs.Mood.renderCommentPanelImportsCallback, data); }); } else { qs.Mood._importCommentModule(qs.Mood.renderCommentPanelImportsCallback, data); } }); }, _commentModules: [], clearCommentModules: function() {
    for (var i = 0, len = this._commentModules.length; i < len; i++) { this._commentModules[i].hideCommentBox(); this._commentModules[i] = null; }
    this._commentModules = [];
}, renderCommentPanelImportsCallback: function(data) {
    if ('undefined' != (typeof User)) { User.current = new User({ uin: g_Uin, nickname: g_LoginInfo[6] ? QZFL.string.restHTML(g_LoginInfo[6]) : g_Nickname, avatarUrl: qs.getPURL(g_Uin, 50) }); }
    var commentModule = new F4A.controls.CommentModule({ id: "comment_list_" + data.tid, emoticonSupported: true, showRepliesByDefault: true, showPaginationForm: false, hideReplyAvatar: false, userLinkTarget: "_blank", defaultPageNum: 1, newlineSupported: false, showAllTarget: '_blank', showAllUrl: "http://user.qzone.qq.com/" + data.uin + "/mood/" + data.tid + "." + data.source, avatarTemplate: '<a href="http://user.qzone.qq.com/${uin}" target="_blank"><img src="${avatarUrl}" style="width:35px; height:35px;" alt="${nickname}" /></a>' }); commentModule.setCommentTotal(data.count); commentModule.isAbleToRemove = function(obj) { return false; }; commentModule.postComment = function(content, callbacks) { var sender = new QZFL.FormSender("http://taotao.qq.com/cgi-bin/emotion_cgi_comment", "POST", { con: content, ptid: data.tid, puin: data.uin, otype: "json", uin: g_Uin, hostuin: g_Uin }, "UTF-8"); sender.onSuccess = function(data) { if (data.result.code == 0) { callbacks.onSuccess(new MoodComment({ ptid: data.tid, puin: data.uin, id: data.tid, content: content, poster: User.current, postTime: '刚刚' })); } else if (-114 == data.result.code) { QZONE.FP.showMsgbox("评论成功，待主人审核后显示", 4, 1500); } else if (202 == data.result.code || 201 == data.result.code) { QZONE.FP.showMsgbox("抱歉，主人设置了评论权限，无法评论", 5, 1500); } else { callbacks.onError(); } }; sender.onError = function() { callbacks.onError(); }; sender.send(); }; commentModule.postReply = function(content, comment, callbacks) {
        var sender = new QZFL.FormSender("http://taotao.qq.com/cgi-bin/emotion_cgi_addreply", "POST", { con: content, ptid: data.tid, puin: data.uin, ctid: comment._id, cuin: comment._poster._uin, otype: "json", uin: g_Uin, hostuin: g_Uin }, "UTF-8"); sender.onSuccess = function(data) {
            if (data.result.code == 0) { callbacks.onSuccess(new MoodReply({ id: data.tid, content: content, ptid: comment.ptid, puin: comment.puin, ctid: comment._id, cuin: comment._poster._uin, poster: User.current, postTime: '刚刚' })); }
            else { callbacks.onError(); } 
        }; sender.onError = function() { callbacks.onError(); }; sender.send();
    }; commentModule.removeComment = function(comment, callbacks) {
        var sender = new QZFL.FormSender("http://taotao.qq.com/cgi-bin/emotion_cgi_delcomment", "POST", { ptid: comment.ptid, puin: comment.puin, tid: comment._id, uin: comment._poster._uin, otype: "json" }, "UTF-8"); sender.onSuccess = function(data) {
            if (data.result.code == 0) { callbacks.onSuccess(); }
            else { callbacks.onError(); } 
        }; sender.onError = function() { callbacks.onError(); }; sender.send();
    }; commentModule.removeReply = function(reply, callbacks) {
        var sender = new QZFL.FormSender("http://taotao.qq.com/cgi-bin/emotion_cgi_delreply", "POST", { puin: reply.puin, ptid: reply.ptid, cuin: reply.cuin, ctid: reply.ctid, tid: reply._id, uin: reply._poster._uin, otype: "json" }, "UTF-8"); sender.onSuccess = function(data) {
            if (data.result.code == 0) { callbacks.onSuccess(); }
            else { callbacks.onError(); } 
        }; sender.onError = function() { callbacks.onError(); }; sender.send();
    }; commentModule.onError = function(code, showHint) { switch (code) { case 'comment-too-long': showHint('评论内容太长啦~'); break; case 'comment-no-content': showHint('请输入评论内容~'); break; case 'reply-too-long': showHint('回复内容太长啦~'); break; case 'reply-no-content': showHint('请输入回复内容~'); break; } }; commentModule.onCommentNodeCreated = function(comment, commentNode) { }; commentModule.onReplyNodeCreated = function(reply, replyNode) { }; commentModule.onCommentNodeRemoved = function(comment, commentNode) { }; commentModule.onReplyNodeRemoved = function(reply, replyNode) { }; commentModule.init($("comment_listpanel_" + data.finger)); commentModule.showCommentBox(); this._commentModules.push(commentModule);
} 
}; qs.UserInfo = { queue: { nickname: [], qqremark: [], vip: [], vip2: [], mood: [] }, presentUserInfo: function(el, type, opt) {
    var arrEl = [], arrUin = [], regx_link = /nameCard_(\d{5,10})/, arrUinPool = [], arrElPool = [], els = QZFL.dom.getElementsByClassName("q_" + type, "*", el), tmp, uin; for (var i = 0, len = els.length; i < len; i++) { if (tmp = regx_link.exec(els[i].getAttribute("link"))) { arrEl.push(els[i]); uin = parseInt(tmp[1], 10); els[i].uin = uin; arrUin.push(uin); } }
    arrUinPool = arrUin.splice(0, 30); arrElPool = arrEl.splice(0, 30); this.queue[type].push([arrElPool, arrUinPool]); while (arrUin.length > 0) { arrUinPool = arrUin.splice(0, 30); arrElPool = arrEl.splice(0, 30); this.queue[type].push([arrElPool, arrUinPool]); }
    this._makePresent(type, opt);
}, _makePresent: function(type, opt) { var arr, th = qs.UserInfo; if (arr = th.queue[type].shift()) { th["_" + type](arr[0], arr[1], type, opt); } }, _qqremark: function(els, arrUin, type, opt) {
    var reg, highlightWord = opt.searchWord || ''; QZONE.FP.getRemarkList(function(rmks) {
        rmks = rmks || {}; var uin; QZFL.object.each(els, function(el) {
            uin = el.uin, rmk = rmks[uin]; if (rmk) {
                rmk = escHTML(QZFL.string.trim(rmks[uin])); reg = new RegExp(highlightWord, 'i'); if ('' != highlightWord) { rmk = rmk.replace(reg, '<span class="c_tx4">' + highlightWord + '</span>'); }
                if ('' != rmk) {
                    parentTitle = el.parentNode.title; var tmpArr = parentTitle.split(' '); if (0 < tmpArr.length) { el.parentNode.title = tmpArr[0] + ' [' + rmk + '] '; if (tmpArr[1]) { el.parentNode.title += tmpArr[1]; } } else { el.parentNode.title = parentTitle + ' [' + rmk + ']'; }
                    el.innerHTML = '[' + rmk + ']';
                } 
            } 
        }, { customTime: 250 }); setTimeout(function() { qs.UserInfo._makePresent(type); }, 500);
    });
}, _nickname: function(els, arrUin, type) {
    QZONE.FP.getRemarkList(function(rmks) {
        rmks = rmks || {}; QZONE.FP.getPortraitList(arrUin, function(data) {
            if (data) {
                var uin, info; QZFL.object.each(els, function(el) {
                    uin = el.uin, info = data[uin], rmk = rmks[uin]; if (rmk) { el.title = rmk; el.innerHTML = QZFL.string.escHTML(rmk); }
                    else { if (info && info[6] != undefined) { el.title = QZFL.string.restXHTML(info[6]); el.innerHTML = info[6]; } } 
                }, { customTime: 250 })
            }
            setTimeout(function() { qs.UserInfo._makePresent(type); }, 500);
        })
    })
}, _vip: function(els, arrUin, type) {
    QZONE.FP.getPortraitList(arrUin, function(data) {
        if (data) {
            var uin, info; QZFL.object.each(els, function(el) {
                uin = el.uin, info = data[uin]; if (info && info[3] != undefined && info[3] != 0) {
                    if (type == "vip2") { el.innerHTML = format('<i class="qz_vip_icon_m_{0}"></i>', info[3]); }
                    else { el.innerHTML = format('<i class="qz_vip_icon_s_{0}"></i>', info[3], uin); } 
                } 
            }, { customTime: 250 })
        }
        setTimeout(function() { qs.UserInfo._makePresent(type); }, 500);
    })
}, _vip2: function(els, arrUin, type) { qs.UserInfo._vip(els, arrUin, "vip2"); }, _mood: function(els, arrUin, type) { qs.Mood.getMoodList(arrUin, function(data) { var uin; QZFL.object.each(els, function(el) { var html = ''; if (data.update[el.uin] || data.emotion[el.uin]) { return el.innerHTML = tmpl('tmpl_userupdate', { emotion: data.emotion[el.uin], update: data.update[el.uin] }); } }) }) } 
}; qs.Filter = { item: null, mapSource: [['全部来源', 0], ['本空间', 3], ['来自好友', 1], ['来自非好友', 2], ['来自认证空间', 5]], mapDaynum: [['全部时间', 0], ['一天内', 1], ['一周内', 7], ['一月内', 30], ['一年内', 365]], mapSort: [['按匹配度排序', 0], ['按时间排序', 1]], isShow: false, init: function(id, opt) { var el = $(id), th = qs.Filter; th._modifyMapSource(); if (el && (th.item = el)) { th.present(); } }, _modifyMapSource: function() { var th = qs.Filter; for (var i = 0, len = th.mapSource.length; i < len; i++) { if ('本空间' == th.mapSource[i][0]) { th.mapSource[i][1] = (g_Parent.ownermode) ? 3 : 4; } } }, present: function() {
    var th = qs.Filter, tmpl = '<div class="fn_leftNav bgr2">\
    <ul id="search_filter_sort">{0}</ul>\
    <ul id="search_filter_source">{1}</ul>\
    <ul id="search_filter_daynum">{2}</ul>\
   </div>'; th.initWideLayoutStyle(); if (2 == qs.Parameters.businesstype) { delete (th.mapSource[1]); }
    if (th.item) { th.item.innerHTML = format(tmpl, th.getHTML(th.mapSort, qs.Parameters.sort, 'clickSort'), th.getHTML(th.mapSource, qs.Parameters.resultset, 'clickSource'), th.getHTML(th.mapDaynum, qs.Parameters.daynum, 'clickDaynum')); } 
}, getHTML: function(map, current, type) {
    var item, arr = []; for (var i = 0, len = map.length; i < len; i++) {
        if ('undefined' == typeof map[i]) { continue; }
        item = map[i]; arr.push((current == item[1] ? '<li><strong class="arrow">&gt;</strong>  ' + item[0] + '</li>' : '<li><a href="javascript:;" onclick="qs.Filter.' + type + '(\'' + item[1] + '\');return false;" class="c_tx">' + item[0] + '</a></li>'));
    }
    return arr.join('');
}, initWideLayoutStyle: function() { var th = qs.Filter, isWideLayoutStyle = QZONE.FP.getQzoneConfig('wide'), elWrap = $('mainContainerWrap'); if (isWideLayoutStyle) { QZFL.css.addClassName(elWrap, 'mode_lay_wide'); } else { QZFL.css.removeClassName(elWrap, 'mode_lay_wide'); } }, clickSource: function(index, fromBlogPageAllLink) { var th = qs.Filter, entry = fromBlogPageAllLink ? 65 : 10; qs.setEntry(entry); qs.Parameters.resultset = index; $('search_filter_source').innerHTML = th.getHTML(th.mapSource, index, 'clickSource'); th.onChange(); if (fromBlogPageAllLink) { qs.PV('blogresult-all'); } else { th.PV(index, 'clickSource'); } }, clickDaynum: function(index) { var th = qs.Filter; qs.setEntry(54); qs.Parameters.daynum = index; $('search_filter_daynum').innerHTML = th.getHTML(th.mapDaynum, index, 'clickDaynum'); th.onChange(); th.PV(index, 'clickDaynum'); }, clickSort: function(index) { var th = qs.Filter; qs.setEntry(54); qs.Parameters.sort = index; $('search_filter_sort').innerHTML = th.getHTML(th.mapSort, index, 'clickSort'); th.onChange(); th.PV(index, 'clickSort'); }, onChange: QZFL.emptyFn, conditions2Text: function() {
    var text = ''; if (qs.Parameters.resultset) { if ('1' == qs.Parameters.resultset) { text = '来自好友'; } else if ('2' == qs.Parameters.resultset) { text = '来自非好友'; } else if ('3' == qs.Parameters.resultset || '4' == qs.Parameters.resultset) { text = '本空间'; } }
    if (qs.Parameters.daynum) { switch (qs.Parameters.daynum) { case '1': text += '一天内'; break; case '7': text += '一周内'; break; case '30': text += '一月内'; break; case '365': text += '一年内'; break; default: break; } }
    return text;
}, isDefaultFilterCondition: function() {
    var p = qs.Parameters; var tmpParams = { sort: isUndefined(p.sort) ? 0 : p.sort, daynum: isUndefined(p.daynum) ? 0 : p.daynum, resultset: isUndefined(p.resultset) ? 0 : p.resultset }; if (0 != tmpParams.sort || 0 != tmpParams.daynum || 0 != tmpParams.resultset) { return false; }
    return true;
}, 
	PV: function(index, type) { var mapSource = { '0': 'result-allsource', '1': 'result-friends', '2': 'result-notfriends', '3': 'result-space', '4': 'result-space', '5': 'result-mingren' }; var mapDaynum = { '0': 'result-alltime', '1': 'result-day', '7': 'result-week', '30': 'result-month', '365': 'result-year' }; var mapSort = { '0': 'result-matchsort', '1': 'result-timesort' }; switch (type) { case 'clickSource': qs.PV(mapSource[index]); break; case 'clickDaynum': qs.PV(mapDaynum[index]); break; case 'clickSort': qs.PV(mapSort[index]); break; default: break; } } 
}; qs.SearchHistory = { item: null, data: null, init: function(id) { try { QZONE.FP.synSORead('so', 5000, function() { qs.SearchHistory._init(id); }); } catch (err) { return; } }, _init: function(id) { var el = $(id), th = qs.SearchHistory; if (el && (th.item = el)) { th.getData(); } }, _parseData: function(o, parser) {
    var data = []; for (var k in o) { data[k] = o[k]; }
    return data;
}, getData: function() {
    var th = qs.SearchHistory, so = g_Parent.QZFL.shareObject, soKey = 'qzone_soso_history_' + g_Uin, arrData; var data = null; try { data = so.get(soKey); } catch (err) { return; }
    if (data && typeof (data) == 'object') { arrData = th._parseData(data); arrData.reverse(); th.data = arrData; th.present(); } 
}, present: function() {
    var tmpl = '<h4 class="fn_hx"><span class="op"><a href="javascript:;" onclick="qs.SearchHistory.clear();return false;" class="c_tx">清空</a></span>搜索历史</h4><div class="box_cont" id="search_history_container">{0}</div>', tmplItem = '<li keyword="{0}" onmouseover="qs.SearchHistory.itemOver(this);" onmouseout="qs.SearchHistory.itemOut(this);"><a href="javascript:;" onclick="qs.SearchHistory.doSearch(this);return false;" class="c_tx">{1}</a><span title="删除记录" onclick="qs.SearchHistory.deleteItem(this);" class="c_tx3 none">&#215;</span></li>'; var th = qs.SearchHistory, data = th.data, tmp, arrLi = []; for (var i = 0, len = data.length; i < len; i++) { tmp = data[i]; arrLi.push(format(tmplItem, escHTML(tmp), escHTML(tmp))) }
    th.item.innerHTML = format(tmpl, arrLi.length > 0 ? "<ul>" + arrLi.join("") + "</ul>" : '<span class="c_tx3">暂无搜索记录</span>');
}, insert: function(key) {
    var so = g_Parent.QZFL.shareObject, soKey = 'qzone_soso_history_' + g_Uin, data, arrData = [], th = qs.SearchHistory; try { data = so.get(soKey); } catch (err) { return; }
    if ((key && key.length == 0) || key == '') { th.getData(); return; }
    if (data && typeof (data) == 'object') { arrData = th._parseData(data); }
    arrData.unshift(key); try { so.set(soKey, (uniqueArray(arrData)).slice(0, 5)); } catch (err) { }
    th.getData();
}, deleteItem: function(el) {
    var so = g_Parent.QZFL.shareObject, soKey = 'qzone_soso_history_' + g_Uin, data, arrData = [], th = qs.SearchHistory, key = el.parentNode.getAttribute('keyword'); try { data = so.get(soKey); } catch (err) { return; }
    if (data && typeof (data) == 'object') {
        arrData = th._parseData(data); var n = -1; for (var i = 0; i < arrData.length; i++) { if (arrData[i] == key) { n = i; break; } }
        if (n > -1) { arrData.splice(n, 1); } 
    }
    try { so.set(soKey, (uniqueArray(arrData)).slice(0, 5)); } catch (err) { }
    th.getData();
}, doSearch: function(el) { var keyword; qs.PV('history'); if (el && (keyword = el.parentNode.getAttribute('keyword'))) { qs.toPage('home', keyword, { entry: 12 }); return; } }, clear: function() {
    var so = g_Parent.QZFL.shareObject, soKey = 'qzone_soso_history_' + g_Uin; try { so.set(soKey, null); } catch (err) { }
    $('search_history_container').innerHTML = '<span class="c_tx3">暂无搜索记录</span>';
}, itemOver: function(el) { var obj = el.childNodes[el.childNodes.length - 1]; QZFL.css.removeClassName(obj, 'none'); }, itemOut: function(el) { var obj = el.childNodes[el.childNodes.length - 1]; QZFL.css.addClassName(obj, 'none'); } 
}; qs.HotSearch = { item: null, data: null, init: function(id) { var el = $(id), p = qs.HotSearch; if (el && (p.item = el)) { p.getData(); } }, getData: function(callback) {
    var p = qs.HotSearch; var jg = new QZFL.JSONGetter(qs.URL.hotsearch, 'hotsearch', { uin: g_Uin }, 'utf-8'); var ts = new Date(); jg.onSuccess = function(o) {
        var te = new Date(); if (qs.cgiReturnStatic(o.ret)) { g_Parent.TCISD.valueStat(400519, 1, 13, { duration: (te - ts) }); } else { g_Parent.TCISD.valueStat(400519, 3, 15, { duration: (te - ts) }); }
        p.data = (o && o.data && o.data.resultdata) ? o.data.resultdata : []; if (0 < p.data.length) { p.present(); p.addEvents(); $e(p.item).show(); if (typeof (callback) == 'function') { callback(); } } else { $e(p.item).hide(); } 
    }; jg.onError = function() { var te = new Date(); g_Parent.TCISD.valueStat(400519, 2, 14, { duration: (te - ts) }); $e(p.item).hide(); }; jg.send('callback');
}, present: function() {
    var p = qs.HotSearch, tmpl = '<h4 class="fn_hx"><span class="op"><a class="c_tx" href="javascript:void(0);" onclick="qs.PV(\'hotwords-result\');qs.toPage(\'top_hotsearch\');return false;">查看更多»</a></span>热点话题</h4>\
    <div class="box_cont">\
     <ol class="list">{0}</ol>\
    </div>', tmplItem = '<li data-order="{0}"><a href="javascript:;" onclick="qs.HotSearch.doSearch(\'{1}\', {2}, {3}, {4});return false;">{5}</a>{6}</li>', tmplTip = '<div class="bubble bor2 bg3 {0}" {1} onclick="qs.HotSearch.doSearch(\'{2}\', {3}, {4}, {5});"><div class="arr bor2"><div class="bor_bg3"></div></div><div class="cont">{6}</div><div class="bless like" onclick="QZFL.event.cancelBubble();return false;"></div></div>', data = p.data, tmp, arrLi = [], webBox, tipTmpl, key = ''; var tips, style, css, text, itemHtml, max = 48, searchWords = qs.Parameters.search, matchIndex = 0; for (var i = 0, len = data.length; i < len; i++) { tmp = data[i]; key = tmp.keyword; if (QZFL.string.trim(key) == QZFL.string.trim(searchWords)) { matchIndex = i; break; } }
    for (var i = 0, len = data.length; i < len; i++) {
        tmp = data[i]; key = tmp.keyword ? tmp.keyword : tmp.title; webBox = tmp.webbox; tipTmpl = tmplTip; if (tmp.tip) {
            text = tmp.tip; if (QZFL.string.getRealLen(text) > max) { text = escHTML(QZFL.string.cut(text, max - 2)) + '&hellip;'; } else { text = escHTML(text); }
            style = 'style="display:none"'; css = ''; if (i == matchIndex) { style = ''; css = 'default'; }
            tips = format(tipTmpl, css, style, key, webBox, !!tmp.link, true, text);
        } else { tips = ''; }
        itemHtml = format(tmplItem, tmp.order, key, webBox, !!tmp.link, false, tmp.title.replace(/\s/g, ''), tips); arrLi.push(itemHtml);
    }
    p.item.innerHTML = format(tmpl, arrLi.join('')); $e(p.item).addClass('bbor2');
}, addEvents: function() { var p = qs.HotSearch; var elContainer = p.item, itemElements = $e(elContainer).find('li'), tipsShow = $e(elContainer).find('div.default').eq(0), itemShow = $e(tipsShow).getParent(), orderShow = itemShow.getAttr('data-order'), itemDataShow = p.getItemData(orderShow); p.getLike(itemShow, function(o) { !o && ($e(tipsShow).setStyle('height', 'auto')); }); var idSettimeout, text; itemElements.bind('mouseover', function() { var currentItem = this, currentTipsElem = $e(currentItem).find('div.bubble').eq(0), order = $e(currentItem).getAttr('data-order'), itemData = p.getItemData(order); if (currentTipsElem != tipsShow) { if (0 < $e(currentTipsElem).elements.length) { text = (QZFL.userAgent.firefox) ? currentTipsElem.contentText : currentTipsElem.innerText; if ('' != QZFL.string.trim(text)) { idSettimeout = setTimeout(function() { qs.PV("hotwords-result-mouseover"); p.getLike($e(currentItem), function(o) { !o && ($e(currentTipsElem).setStyle('height', 'auto')); $e(tipsShow).hide(); $e(currentTipsElem).show(); tipsShow = currentTipsElem; }); }, 500); $e(this).bind('mouseout', function() { clearTimeout(idSettimeout); }); } } } }); }, getItemData: function(order) {
    var p = qs.HotSearch, itemData; for (var i = 0, len = p.data.length; i < len; i++) { if (p.data[i].order == order) { itemData = p.data[i]; break; } }
    return itemData;
}, doSearch: function(keyword, webBox, isLink, isTip) {
    var p = qs.HotSearch; if (isTip) { qs.PV('hotwords-result-tips-click'); }
    if (isLink) { qs.PV('hotwords-url'); window.open(keyword); } else { qs.PV('hotwords'); qs.toPage('home', keyword, { entry: 11, webbox: webBox }); } 
}, getLikeData: function(keys, callback) {
    var url = 'http://' + QZONE.FP._t.g_R_Domain + '/cgi-bin/qzonesoso/cgi_qzonesoso_showlike', jg = new QZFL.JSONGetter(url, 'hotsearch_getlike', { uin: g_Uin, keys: keys, t: (new Date()).getTime() }, 'utf-8'); var ts = new Date(); jg.onSuccess = function(o) {
        var te = new Date(); if (qs.cgiReturnStatic(o.ret)) { g_Parent.TCISD.valueStat(400520, 1, 13, { duration: (te - ts) }); } else { g_Parent.TCISD.valueStat(400520, 3, 15, { duration: (te - ts) }); }
        var data = (o && o.ret == 0 && o.data && o.data.length > 0) ? o.data : null; if (typeof (callback) == 'function') { callback(data); } 
    }; jg.onError = function() { var te = new Date(); g_Parent.TCISD.valueStat(400520, 2, 14, { duration: (te - ts) }); if (typeof (callback) == 'function') { callback(); } }; jg.send('callback');
}, setLikeData: function(key, callback) {
    var url = 'http://' + QZONE.FP._t.g_W_Domain + '/cgi-bin/qzonesoso/cgi_qzonesoso_dolike', jg = new QZFL.JSONGetter(url, 'hotsearch_setlike', { uin: g_Uin, key: key, t: (new Date()).getTime() }, 'utf-8'); var ts = new Date(); jg.onSuccess = function(o) {
        var te = new Date(); if (qs.cgiReturnStatic(o.ret)) { g_Parent.TCISD.valueStat(400521, 1, 13, { duration: (te - ts) }); } else { g_Parent.TCISD.valueStat(400521, 3, 15, { duration: (te - ts) }); }
        var data = (o && o.ret == 0 && o.data) ? o.data : null; if (typeof (callback) == 'function') { callback(data); } 
    }; jg.onError = function() { var te = new Date(); g_Parent.TCISD.valueStat(400521, 2, 14, { duration: (te - ts) }); }; jg.send('callback');
}, getLike: function(item, callback) {
    if (item.eq(0)) {
        var p = qs.HotSearch, order = item.getAttr('data-order'), itemData = p.getItemData(order); p.getLikeData(itemData.likekey, function(likeData) {
            if (likeData) { p.updateLike(item, itemData, likeData[0]); }
            if (typeof (callback) == 'function') { callback(!!likeData); } 
        });
    } 
}, setLike: function(item, itemData, likeData) { var p = qs.HotSearch, likePanel = item.find('div.like'), likeBtn = likePanel.find('span.btn'), likeCount = likePanel.find('span.count'), likeFriends = likePanel.find('span.friends'), curCount = parseInt(likeCount.getHtml(), 10); likeBtn.setHtml('看一看').addClass('liked'); likeFriends.setHtml(p.formatFriends(likeData.friends, true)); likeCount.setHtml(p.formatCount(curCount + 1, (likeData.friends.length == 0 ? -1 : 0))); p.setLikeData(itemData.likekey, function(likeData) { }); }, updateLike: function(item, itemData, likeData) { var p = qs.HotSearch; p.presentLike(item, itemData, likeData); p.addLikeEvents(item, itemData, likeData); }, presentLike: function(item, itemData, likeData) { var p = qs.HotSearch, likeContainer = item.find('div.like'), tmplLike = '<div class="op"><span class="btn {4}"><i class="ui_ico {0}"></i><span class="op_name">{1}</span></span></div><div class="c_tx3"><span class="friends">{2}</span><span class="count">{3}</span>人{5}</div>', liked = likeData.liked - 0; likeContainer.setHtml(format(tmplLike, liked ? '' : 'ico_' + itemData.likeicon, liked ? '看一看' : itemData.liketext, p.formatFriends(likeData.friends, liked), p.formatCount(likeData.count, (liked && likeData.friends.length == 0 ? -1 : 0), true), liked ? 'c_tx liked' : 'c_tx', itemData.liketext)); }, addLikeEvents: function(item, itemData, likeData) {
    var p = qs.HotSearch, likeBtn = item.find('div.like span.btn'); likeBtn.onClick(function() {
        if (!likeBtn.hasClass('liked'))
        { qs.PV('hotwords-like'); p.setLike(item, itemData, likeData); p.sendShareFeed(itemData, likeData); } else { (likeBtn.getParent().getParent().getParent().getAttr('onclick'))(); }
        QZFL.event.cancelBubble(); return false;
    });
}, formatFriends: function(friends, liked) {
    var tmp, realLen, displayName, friendsArr = [], likeFriends; liked = liked - 0; friends = friends.slice(0, 1); for (var i = 0, len = friends.length; i < len; i++) {
        tmp = friends[i]; realLen = QZFL.string.getRealLen(tmp); if (realLen > 4) { displayName = QZFL.string.escHTML(QZFL.string.cut(tmp, 4)) + '&hellip;'; } else { displayName = QZFL.string.escHTML(tmp); }
        friendsArr.push(format('<span title="{0}">{1}</span>', QZFL.string.escHTML(tmp), displayName));
    }
    likeFriends = (liked ? '我和' : '') + (friendsArr.length > 0 ? friendsArr.join('、') + '等' : (liked ? '其他' : '已有')); return likeFriends;
}, formatCount: function(count, offset, isRealVal, num) { num = (num - 0) || 7; var f = Math.pow(10, num - 1) - 1, c = !!isRealVal ? Math.floor(count * 9.13) : count; c += (offset - 0) || 0; return (num > 0 && c > f) ? (f + '+') : c; }, sendShareFeed: function(itemData, likeData) { var jumpUrl = itemData.link ? itemData.keyword : 'http://rc.qzone.qq.com/qzonesoso/isfromic=1&businesstype=all&entry=72&search=' + encodeURIComponent(itemData.keyword), picUrl = itemData.picurl, dotIndex = picUrl.lastIndexOf('.'), picUrl = picUrl ? (picUrl.substr(0, dotIndex) + '_l' + picUrl.substr(dotIndex)) : ''; var data = { uin: g_Uin, site: '空间搜索', type: 21, url: jumpUrl, title: itemData.title, comment: itemData.liketext, summary: itemData.sharetext || itemData.tip, images: picUrl, keyword: itemData.keyword }; qs.Interface.Share.sendShareFeed(data, { entryId: 72 }, function() { }, function() { }); } 
}; qs.SearchTrend = { item: null, data: null, pageIndex: 0, init: function(id) { var el = $(id), st = qs.SearchTrend; if (el && (st.item = el)) { st._getData(); } }, _getData: function(callback) {
    var st = qs.SearchTrend; var jg = new QZFL.JSONGetter(qs.URL.searchtrend, "searchtrend", null, "utf-8"); jg.onSuccess = function(data) { st.data = st._handleData(data); if (st.data) { st._present(); st._addEvents(); if (typeof (callback) == "function") { callback(); } } }
    jg.onError = function() { var st = qs.SearchTrend; $e(st.item).hide(); }
    jg.send("_Callback");
}, _handleData: function(data) {
    var st = qs.SearchTrend; if (data.pkwords) { var num1 = parseInt(data.pkwords.word1_num, 10), num2 = parseInt(data.pkwords.word2_num, 10), percent1 = Math.round(100 * num1 / (num1 + num2)), percent2 = 100 - percent1; data.pkwords.word1_percent = percent1; data.pkwords.word2_percent = percent2; }
    data.hotwords = data.hotwords.slice(0, 15); st.pages = Math.ceil(data.hotwords.length / 5); return data;
}, _present: function() {
    var tmpl = '<h4 class="fn_hx">空间风向标</h4>{0}' + '<div class="box_cont">' + '<div class="box_cont_wrap st_words_panel"><ul>{1}</ul></div>' + '</div>{2}', tmplPager = '<div class="opt">' + '<a href="javascript:;" title="上一页" class="l bor2 st_pager_prev"><i class="c_tx3"></i></a>' + '<a href="javascript:;" title="下一页" class="r bor2 st_pager_next"><i class="c_tx"></i></a>' + '</div>', tmplPk = '<div class="box_pk">' + '<div class="tit">{0}PK</div>' + '<div class="who">' + '<a href="javascript:;" class="l c_tx st_link">{1}</a><span>VS</span><a href="javascript:;" class="r c_tx st_link">{2}</a>' + '</div>' + '<div class="per bor2 c_tx2">' + '<span class="l bg6 st_percent" style="width:{3}%">{5}%<span class="bubble bor2 bg3 c_tx2">被 {7} 人提到<i class="bor2"><i class="bor_bg3"></i></i></span></span>' + '<span class="r bg2 st_percent" style="width:{4}%">{6}%<span class="bubble bor2 bg3">被 {8} 人提到<i class="bor2"><i class="bor_bg3"></i></i></span></span>' + '</div>' + '</div>', tmplItem = '<li>{0} <span class="bor2"></span><a href="javascript:;" class="c_tx st_link">{1}</a></li>'; var st = qs.SearchTrend, data = st.data, tmp, arrLi = [], pkwords = data.pkwords, pkHtml = ''; if (pkwords && pkwords.title != '') {
        var leftWidth = (pkwords.word1_percent < 10 ? 10 : pkwords.word1_percent), rightWidth = 100 - leftWidth; if (rightWidth < 10) { rightWidth = 10; leftWidth = 90; }
        pkHtml = format(tmplPk, pkwords.title, pkwords.word1, pkwords.word2, leftWidth, rightWidth, pkwords.word1_percent, pkwords.word2_percent, pkwords.word1_num, pkwords.word2_num);
    }
    for (var i = 0, len = data.hotwords.length; i < len; i++) {
        tmp = data.hotwords[i]; if (i > 0 && (i % 5 == 0))
        { arrLi.push('</ul><ul>'); }
        arrLi.push(format(tmplItem, tmp.title, tmp.word));
    }
    st.item.innerHTML = format(tmpl, pkHtml, arrLi.join(''), (data.hotwords.length > 5) ? tmplPager : ''); $e(st.item).addClass('bbor2');
}, _addEvents: function() {
    var st = qs.SearchTrend; $e(st.item).find('a.st_link').onClick(function() { st._doSearch($e(this).getHtml()); return false; }); $e(st.item).find('span.st_percent').onHover(function() { $e(this).find('span').show('none'); }, function() { $e(this).find('span').hide('none'); }); var words_panel = $e(st.item).find('div.st_words_panel'); $e(st.item).find('a.st_pager_prev').onClick(function() {
        if (st.pageIndex > 0) {
            st.pageIndex--; var prev_icon = $e(this).find('i'); var next_icon = $e(st.item).find('a.st_pager_next i'); if (st.pageIndex == 0) { prev_icon.removeClass('c_tx').addClass('c_tx3'); }
            if (next_icon.hasClass('c_tx3')) { next_icon.removeClass('c_tx3').addClass('c_tx'); }
            words_panel.setStyle('marginLeft', (st.pageIndex * -180) + 'px');
        } 
    }); $e(st.item).find('a.st_pager_next').onClick(function() {
        if (st.pageIndex < (st.pages - 1)) {
            st.pageIndex++; var next_icon = $e(this).find('i'); var prev_icon = $e(st.item).find('a.st_pager_prev i'); if (st.pageIndex == (st.pages - 1)) { next_icon.removeClass('c_tx').addClass('c_tx3'); }
            if (prev_icon.hasClass('c_tx3')) { prev_icon.removeClass('c_tx3').addClass('c_tx'); }
            words_panel.setStyle('marginLeft', (st.pageIndex * -180) + 'px');
        } 
    });
}, _doSearch: function(keyword) { qs.PV("trend"); qs.toPage("home", keyword, { entry: 69 }); } 
}; qs.initAdv = function(elemId, type, callback) { return new qs.Advertisement(elemId, type, callback); }; qs.Advertisement = function(id, type, callback) {
    this.id = id; if ('undefined' == typeof (type) || null == type) { this.type = 'Paipai'; } else { this.type = type; }
    this.init(callback);
}; qs.Advertisement.prototype = { el: null, init: function(cb) {
    var id = this.id, type = this.type; var jsURL = 'http://' + g_Parent.siDomain + '/qzone/biz/gdt/comm/express_qzonesearch.js'; var el = $(id); var _this = this; if (el && (this.el = el)) {
        QZFL.imports(jsURL, function() {
            var keyword = qs.Parameters.search; GdtPromote.get(keyword, function(res) {
                if (false == res.ret) { _this.clear(); } else { if (0 < res.data.length) { _this['present' + _this.type](res.data[0]); } else { _this.clear(); } }
                if (cb && 'function' == typeof cb) { cb.call(_this); } 
            });
        });
    } 
}, presentPaipai: function(obj) {
    var tmpl = '\
     <h4 class="fn_hx">为您推荐</h4>\
     <div class="box_cont">\
      <a class="fn_paipai_roc_tit bg2" target="_blank" href="http://www.paipai.com"></a>\
      <div class="fn_paipai_roc_img">\
       <a href="{0}" target="_blank"><img src="{1}" style="width:160px;height:160px;" alt="广告图片" /><b></b>{2}</a>\
      </div>\
      <p class="fn_paipai_roc_txt"><a target="_blank" href="{0}" class="c_tx">{3}</a></p>\
      <p class="c_tx3">拍拍价：<strong class="c_tx4">{4}</strong>元</p>\
     </div>'; var soldNumHTML = '', desc = obj.desc, max = 44; if (max < QZFL.string.getRealLen(desc)) { desc = QZFL.string.cut(desc, max); }
    this.el.innerHTML = format(tmpl, obj.ln, obj.img, soldNumHTML, this._handleForSearchWord(desc), obj.price); $e(this.el).show(); $e('#widget_history').addClass('bbor2');
}, _handleForSearchWord: function(text) { if ('undefined' == typeof (qs.Parameters.search)) { return text; } else { var reg = eval("/" + qs.Parameters.search + "/ig"); text = text.replace(reg, function(word) { return '<span class="c_tx4">' + word + '</span>'; }); return text; } }, clear: function() { $e(this.el).hide(); } 
}; qs.Parameters = { search: "", sort: 0, start: 0, entry: 0, businesstype: 7, mix: 0, resultset: 0, typeText: "说说  & 日志", daynum: 0, setTitleText: function() { var map = { "7": "说说 & 日志", "1": "日志", "2": "说说", "-1": "用户" }; return (qs.Parameters.typeText = map[qs.Parameters.businesstype]); } }; qs.PageNav = { pIndex: 1, pCount: 1, pSize: 15, getHTML: function() {
    var th = qs.PageNav, pIndex = th.pIndex, pCount = th.pCount; var html = '<p class="mod_pagenav_main">' + (pIndex == 1 ? '<span class="mod_pagenav_disable"><span>上一页</span></span>' : '<a class="c_tx bor3" title="上一页" href="javascript:;" onclick="qs.PV(\'lastpage\');qs.PageNav.onPrePage();return false;"><span><span class="arrow">&lt;</span>上一页</span></a>') +
(qs.PageNav.genPageIndex()) +
((pIndex == pCount) ? '<span class="mod_pagenav_disable"><span>下一页</span></span>' : '<a class="c_tx bor3" title="下一页" href="javascript:;" onclick="qs.PV(\'nextpage\');qs.PageNav.onNextPage();return false;"><span>下一页<span class="arrow">&gt;</span></span></a>') + '</p>'
    if (1 == pCount) { return ""; }
    return html;
}, genPageIndex: function() {
    var th = qs.PageNav, total = th.pCount; curIndex = th.pIndex, start = Math.max(curIndex - 5, 1), end = Math.min(start + 10, total), start = Math.max(end - 10, 1), result = []; result.push('&nbsp;<span class="mod_pagenav_count">'); for (var index = start; index <= end; ++index) {
        if (start >= 2 && index == start) { result.push('<a href="javascript:;" class="c_tx bor3" title="1" onclick="qs.PV(1);qs.PageNav.onGo(1);return false;">1</a>&nbsp;<span class="mod_pagenav_more c_tx bor3"><span>...</span></span>&nbsp;'); continue; }
        if ((end <= total - 1) && index == end) { result.push('<span class="mod_pagenav_more c_tx bor3"><span>...</span></span>'); continue; }
        result.push((index != curIndex) ? ('<a href="javascript:;" title="' + index + '" class="c_tx bor3" onclick="qs.PV(' + index + ');qs.PageNav.onGo(' + index + ');return false;">' + index + '</a> ') : (' <span class="current bg2"><span>' + index + '</span></span> '));
    }
    result.push('</span>&nbsp;'); return result.join("");
}, onNextPage: QZFL.emptyFn, onPrePage: QZFL.emptyFn, onGo: QZFL.emptyFn
}; qs.Weibo = {}; (function() {
    var emList = { '微笑': 100, '撇嘴': 101, '色': 102, '发呆': 103, '發呆': 103, '得意': 104, '流泪': 105, '流淚': 105, '害羞': 106, '闭嘴': 107, '閉嘴': 107, '睡': 108, '大哭': 109, '尴尬': 110, '尷尬': 110, '发怒': 111, '發怒': 111, '调皮': 112, '調皮': 112, '呲牙': 113, '惊讶': 114, '驚訝': 114, '难过': 115, '難過': 115, '酷': 116, '冷汗': 117, '抓狂': 118, '吐': 119, '偷笑': 120, '可爱': 121, '可愛': 121, '白眼': 122, '傲慢': 123, '饥饿': 124, '飢餓': 124, '困': 125, '惊恐': 126, '驚恐': 126, '流汗': 127, '憨笑': 128, '大兵': 129, '奋斗': 130, '奮鬥': 130, '咒骂': 131, '咒罵': 131, '疑问': 132, '疑問': 132, '嘘': 133, '噓': 133, '晕': 134, '暈': 134, '折磨': 135, '衰': 136, '骷髅': 137, '骷髏': 137, '敲打': 138, '再见': 139, '再見': 139, '擦汗': 140, '抠鼻': 141, '摳鼻': 141, '鼓掌': 142, '糗大了': 143, '坏笑': 144, '左哼哼': 145, '右哼哼': 146, '哈欠': 147, '鄙视': 148, '鄙視': 148, '委屈': 149, '快哭了': 150, '阴险': 151, '陰險': 151, '亲亲': 152, '親親': 152, '吓': 153, '嚇': 153, '可怜': 154, '可憐': 154, '菜刀': 155, '西瓜': 156, '啤酒': 157, '篮球': 158, '籃球': 158, '乒乓': 159, '咖啡': 160, '饭': 161, '飯': 161, '猪头': 162, '豬頭': 162, '玫瑰': 163, '凋谢': 164, '凋謝': 164, '示爱': 165, '示愛': 165, '爱心': 166, '愛心': 166, '心碎': 167, '蛋糕': 168, '闪电': 169, '閃電': 169, '炸弹': 170, '炸彈': 170, '刀': 171, '足球': 172, '瓢虫': 173, '瓢蟲': 173, '便便': 174, '月亮': 175, '太阳': 176, '太陽': 176, '礼物': 177, '禮物': 177, '拥抱': 178, '擁抱': 178, '强': 179, '強': 179, '弱': 180, '握手': 181, '胜利': 182, '勝利': 182, '抱拳': 183, '勾引': 184, '拳头': 185, '拳頭': 185, '差劲': 186, '差勁': 186, '爱你': 187, '愛你': 187, 'NO': 188, 'no': 188, 'OK': 189, 'ok': 189, '爱情': 190, '愛情': 190, '飞吻': 191, '飛吻': 191, '跳跳': 192, '发抖': 193, '發抖': 193, '怄火': 194, '慪火': 194, '转圈': 195, '轉圈': 195, '磕头': 196, '磕頭': 196, '回头': 197, '回頭': 197, '跳绳': 198, '跳繩': 198, '挥手': 199, '揮手': 199, '激动': 200, '激動': 200, '街舞': 201, '献吻': 202, '獻吻': 202, '左太极': 203, '左太極': 203, '右太极': 204, '右太極': 204 }; function exchange(word) {
        for (var i = word.length; i > 1; --i) { var key = word.substring(1, i); if (emList[key]) { word = '<img src="http://' + parent.siDomain + '/qzone/em/e' + emList[key] + '.gif" />' + word.substring(i, word.length); break; } }
        return word;
    }; function ubbReplace(content) {
        var fn = QZONE.FP.removeUBB || QZONE.FP._t.removeUBB
        if (typeof fn == "function") { return fn(content) } else { return content.replace(/\[em\]e(3\d{2,}|5\d{2,})\[\/em\]/, ""); } 
    }
    qs.Weibo.replaceEm = function(content) { content = content.replace(/\/[a-z\u4e00-\u9fa5]{1,3}/ig, exchange); return ubbReplace(content); } 
})(); /*  |xGv00|61c7c117acfcaaedeec7e743a9719819 */